def ais_rx(self, src, freq, designator, options, queue): self.rate = options.rate self.u = src self.coeffs = firdes.low_pass(1,self.rate,7000,1000) self._filter_decimation = 4 self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation, self.coeffs, freq, self.rate) self._bits_per_sec = 9600.0; self._samples_per_symbol = self.rate / self._filter_decimation / self._bits_per_sec options.samples_per_symbol = self._samples_per_symbol options.gain_mu = 0.3 options.mu=0.5 options.omega_relative_limit = 0.0001 options.bits_per_sec = self._bits_per_sec #trades off accuracy of freq estimation in presence of noise, vs. delay time. options.fftlen = 4096 options.samp_rate = self.rate / self._filter_decimation #ais_demod.py, hierarchical demodulation block, takes in complex baseband and spits out 1-bit packed bitstream self.demod = ais_demod(options) self.unstuff = unstuff() #ais_unstuff.cc, unstuffs data #should mark start of packet self.start_correlator = digital.correlate_access_code_tag_bb("1010101010101010", 0, "ais_preamble") #should mark start and end of packet self.stop_correlator = digital.correlate_access_code_tag_bb("01111110", 0, "ais_frame") #ais_parse.cc, calculates CRC, parses data into ASCII message, moves data onto queue self.parse = parse(queue, designator, options.verbose, options.lon, options.lat) self.connect(self.u, self.filter, self.demod, self.unstuff, self.start_correlator, self.stop_correlator, self.parse)
def __init__(self, syncword_threshold=None, options=None): gr.hier_block2.__init__(self, "lilacsat_1_deframer", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(0, 0, 0)) options_block.__init__(self, options) self.message_port_register_hier_out('out') self.message_port_register_hier_out('codec2') if syncword_threshold is None: syncword_threshold = self.options.syncword_threshold self.delay1 = blocks.delay(gr.sizeof_float, 1) self.viterbi0 = ccsds_viterbi() self.viterbi1 = ccsds_viterbi() self.differential0 = digital.diff_decoder_bb(2) self.differential1 = digital.diff_decoder_bb(2) self.tag0 = digital.correlate_access_code_tag_bb( _syncword, syncword_threshold, 'syncword') self.tag1 = digital.correlate_access_code_tag_bb( _syncword, syncword_threshold, 'syncword') self.scrambler0 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key='syncword') self.scrambler1 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key='syncword') self.demux0 = lilacsat1_demux('syncword') self.demux1 = lilacsat1_demux('syncword') self.pdu2tag = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.pack = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.multiply_length = blocks.tagged_stream_multiply_length( gr.sizeof_char * 1, 'packet_len', 1 / 8.0) self.tag2pdu = blocks.tagged_stream_to_pdu(blocks.byte_t, 'packet_len') self.pdu2tag_codec2 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.pack_codec2 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.multiply_length_codec2 = blocks.tagged_stream_multiply_length( gr.sizeof_char * 1, 'packet_len', 1 / 8.0) self.tag2pdu_codec2 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.connect(self, self.viterbi0, self.differential0, self.tag0, self.scrambler0, self.demux0) self.connect(self, self.delay1, self.viterbi1, self.differential1, self.tag1, self.scrambler1, self.demux1) self.connect(self.pdu2tag, self.pack, self.multiply_length, self.tag2pdu) self.connect(self.pdu2tag_codec2, self.pack_codec2, self.multiply_length_codec2, self.tag2pdu_codec2) self.msg_connect((self.demux0, 'kiss'), (self.pdu2tag, 'pdus')) self.msg_connect((self.demux1, 'kiss'), (self.pdu2tag, 'pdus')) self.msg_connect((self.demux0, 'codec2'), (self.pdu2tag_codec2, 'pdus')) self.msg_connect((self.demux1, 'codec2'), (self.pdu2tag_codec2, 'pdus')) self.msg_connect((self.tag2pdu, 'pdus'), (self, 'out')) self.msg_connect((self.tag2pdu_codec2, 'pdus'), (self, 'codec2'))
def test_001(self): #test complementary operation of framer & deframer #want to frame some random data that has enough consecutive bits to #stuff at least a few bits npkts = 20 src_data = [0xFE, 0xDA, 0xAC, 0x29, 0x7F, 0xA2, 0x90, 0x0F, 0xF8] frame = digital.hdlc_framer_pb("wat") corr = digital.correlate_access_code_tag_bb("01111110", 0, "frame") deframe = digital.hdlc_deframer_bp("frame", 32, 500) debug = blocks.message_debug() self.tb.connect(frame, corr, deframe) self.tb.msg_connect(deframe, "out", debug, "store") self.tb.start() msg = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(src_data), src_data)) for i in xrange(npkts): frame.to_basic_block()._post(pmt.intern("in"), msg) sleep(0.2) self.tb.stop() self.tb.wait() rxmsg = debug.get_message(0) result_len = pmt.blob_length(pmt.cdr(rxmsg)) msg_data = [] for j in xrange(result_len): msg_data.append(pmt.u8vector_ref(pmt.cdr(rxmsg), j)) self.assertEqual(src_data, msg_data)
def encode_decode_test(self, payload_str="TEST", whitening=False, encode_crc=False, decode_crc=False): preamble = "01010101" sync1 = 0x2 sync2 = 0x3 sync_length = 2 payload = [ord(c) for c in payload_str] strobe = blocks.message_strobe(pmt.cons(pmt.PMT_NIL, pmt.to_pmt(payload)), 200) encoder = cc11xx_encoder.cc11xx_encoder(preamble=[int(preamble, 2)], syncword=[sync1, sync2], whitening=whitening, crc=encode_crc) pdu_to_stream = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") debug = blocks.message_debug() self.tb.msg_connect(strobe, "strobe", encoder, "in") self.tb.msg_connect(encoder, "out", pdu_to_stream, "pdus") unpack = blocks.packed_to_unpacked_bb(1, 0) acc_code_block = digital.correlate_access_code_tag_bb(preamble, 0, "preamble") deframer = cc11xx.cc11xx_deframer_bb(sync1 ,sync2, whitening, decode_crc, sync_length) self.tb.connect(pdu_to_stream,unpack) self.tb.connect(unpack, acc_code_block) self.tb.connect(acc_code_block, deframer) self.tb.msg_connect((deframer, 'out'), (debug, 'store')) self.tb.start() time.sleep(1) self.tb.stop() #Please get rid of this sleep if you know how! time.sleep(0.1) self.tb.stop() result_data = [i for i in pmt.to_python(pmt.cdr(debug.get_message(0)))] self.assertEqual(payload, result_data)
def test_001(self): #test complementary operation of framer & deframer #want to frame some random data that has enough consecutive bits to #stuff at least a few bits npkts = 20 src_data = [0xFE, 0xDA, 0xAC, 0x29, 0x7F, 0xA2, 0x90, 0x0F, 0xF8] frame = digital.hdlc_framer_pb("wat") corr = digital.correlate_access_code_tag_bb("01111110", 0, "frame") deframe = digital.hdlc_deframer_bp("frame", 32, 500) debug = blocks.message_debug() self.tb.connect(frame, corr, deframe) self.tb.msg_connect(deframe, "out", debug, "store") self.tb.start() msg = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(src_data),src_data)) for i in xrange(npkts): frame.to_basic_block()._post(pmt.intern("in"), msg) sleep(0.2) self.tb.stop() self.tb.wait() rxmsg = debug.get_message(0) result_len = pmt.blob_length(pmt.cdr(rxmsg)) msg_data = [] for j in xrange(result_len): msg_data.append(pmt.u8vector_ref(pmt.cdr(rxmsg), j)) self.assertEqual(src_data, msg_data)
def __init__(self, dc_block_len=4, rx_gain=40): gr.top_block.__init__(self, "Uhd Adsb 6") ################################################## # Parameters ################################################## self.dc_block_len = dc_block_len self.rx_gain = rx_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 self.freq = freq = 1090e6 self.filename = filename = "./bytes_" + str(dc_block_len) + ".csv" ################################################## # Message Queues ################################################## adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue( 2) adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb( '1010000101000000', 0, 'adsb_preamble') self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_len, True) self.blocks_message_source_0 = blocks.message_source( gr.sizeof_char * 1, blocks_message_source_0_msgq_in) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/leffke/sandbox/adsb/adsb_20161212_2M_2.32fc', False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, filename, True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out) self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in, tx_msgq=adsb_decoder_0_msgq_out, output_type="csv", check_parity=True) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.adsb_framer_0, 0))
def test_bb_skip_prefix(self): pad = (0, ) * 64 src_data = (0, 1, 1, 1, 1, 0, 0, 1, 1) + pad + (0, ) * 7 src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb("0011", 0, "sync") dst = blocks.tag_debug(gr.sizeof_char, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 1) self.assertEqual(result_data[0].offset, 9)
def __init__(self, preamble="010101010", sync_word="0000111101"): """ @param preamble: the preamble chips @param sync_word: the sync word bits """ gr.hier_block2.__init__( self, "correlate_preamble", gr.io_signature(1, 1, gr.sizeof_char*1), gr.io_signature(1, 1, gr.sizeof_char*1), ) if not packet_utils.is_1_0_string(preamble): raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (preamble,) self.preamble = digital.correlate_access_code_tag_bb(preamble, 0, "preamble") if not packet_utils.is_1_0_string(sync_word): raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (sync_word,) self.sync = digital.correlate_access_code_tag_bb(sync_word, 0, "sync") self.connect(self, self.sync, self.preamble, self)
def test_001(self): pad = (0,) * 64 src_data = (1, 0, 1, 1, 1, 1, 0, 1, 1) + pad + (0,) * 7 src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb("1011", 0, "sync") dst = blocks.tag_debug(1, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 2) self.assertEqual(result_data[0].offset, 4) self.assertEqual(result_data[1].offset, 9)
def test_001(self): pad = (0, ) * 64 src_data = (1, 0, 1, 1, 1, 1, 0, 1, 1) + pad + (0, ) * 7 src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb("1011", 0, "sync") dst = blocks.tag_debug(1, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 2) self.assertEqual(result_data[0].offset, 4) self.assertEqual(result_data[1].offset, 9)
def test_bb_immediate(self): """Test that packets at start of stream match""" pad = (0, ) * 64 src_data = (0, 0, 1, 1) + pad + (0, ) * 7 src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb("0011", 0, "sync") dst = blocks.tag_debug(gr.sizeof_char, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 1) self.assertEqual(result_data[0].offset, 4)
def __init__(self): gr.top_block.__init__(self, "Gr Adsb Example") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 self.freq = freq = 1090e6 ################################################## # Message Queues ################################################## adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2) adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## 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(0, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 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(50, 0) self.osmosdr_source_0.set_if_gain(50, 0) self.osmosdr_source_0.set_bb_gain(50, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(samp_rate, 0) self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb('1010000101000000', 0, 'adsb_preamble') self.blocks_threshold_ff_0 = blocks.threshold_ff(0.3, 0.31, 0) self.blocks_message_source_0 = blocks.message_source(gr.sizeof_char*1, blocks_message_source_0_msgq_in) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/dev/stdout', True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out) self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in,tx_msgq=adsb_decoder_0_msgq_out,output_type="csv",check_parity=True) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.adsb_framer_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
def __init__(self, freq, rate, designator, queue, use_viterbi=False): gr.hier_block2.__init__(self, "ais_rx", gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(0,0,0)) self.coeffs = filter.firdes.low_pass(1, rate, 7000, 1000) self._filter_decimation = 12 #fixed, TODO make settable via params or better yet do resampling self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation, self.coeffs, freq, rate) self._bits_per_sec = 9600.0 self._samples_per_symbol = rate / self._filter_decimation / self._bits_per_sec options = {} options[ "viterbi" ] = use_viterbi options[ "samples_per_symbol" ] = self._samples_per_symbol options[ "gain_mu" ] = 0.3 options[ "mu" ] = 0.5 options[ "omega_relative_limit" ] = 0.003 options[ "bits_per_sec" ] = self._bits_per_sec options[ "fftlen" ] = 4096 #trades off accuracy of freq estimation in presence of noise, vs. delay time. options[ "samp_rate" ] = rate / self._filter_decimation self.demod = ais.ais_demod(options) #ais_demod takes in complex baseband and spits out 1-bit packed bitstream self.unstuff = ais.unstuff() #undoes bit stuffing operation self.start_correlator = digital.correlate_access_code_tag_bb("1010101010101010", 0, "ais_preamble") #should mark start of packet self.stop_correlator = digital.correlate_access_code_tag_bb("01111110", 0, "ais_frame") #should mark start and end of packet self.parse = ais.parse(queue, designator) #ais_parse.cc, calculates CRC, parses data into NMEA AIVDM message, moves data onto queue self.connect(self, self.filter, self.demod, self.unstuff, self.start_correlator, self.stop_correlator, self.parse) #parse posts messages to the queue, which the main loop reads and prints
def __init__(self, packlen=0, sync='00011010110011111111110000011101', threshold=4): gr.hier_block2.__init__( self, 'Sync and create packed PDU', gr.io_signature(1, 1, gr.sizeof_char * 1), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out('out') ################################################## # Parameters ################################################## self.packlen = packlen self.sync = sync self.threshold = threshold ################################################## # Blocks ################################################## self.satellites_fixedlen_tagger_0_0_0 = (satellites.fixedlen_tagger( 'syncword', 'packet_len', packlen * 8, numpy.byte)) self.digital_correlate_access_code_tag_bb_0_0_0 = ( digital.correlate_access_code_tag_bb(sync, threshold, 'syncword')) self.blocks_unpacked_to_packed_xx_0 = (blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST)) self.blocks_tagged_stream_to_pdu_0_0_0 = (tagged_stream_to_pdu( byte_t, 'packet_len')) self.blocks_tagged_stream_multiply_length_0 = ( blocks.tagged_stream_multiply_length(gr.sizeof_char * 1, 'packet_len', 1 / 8.0)) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self, 'out')) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_0_0_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0, 0), (self.satellites_fixedlen_tagger_0_0_0, 0)) self.connect((self, 0), (self.digital_correlate_access_code_tag_bb_0_0_0, 0)) self.connect((self.satellites_fixedlen_tagger_0_0_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
def test_002(self): code = tuple(string_to_1_0_list(default_access_code)) access_code = to_1_0_string(code) pad = (0,) * 64 #print code #print access_code src_data = code + (1, 0, 1, 1) + pad src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb(access_code, 0, "sync") dst = blocks.tag_debug(gr.sizeof_char, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 1) self.assertEqual(result_data[0].offset, len(code))
def test_003(self): code = tuple(string_to_1_0_list(default_access_code)) access_code = to_1_0_string(code) pad = (0,) * 64 #print code #print access_code src_data = code + (1, 0, 1, 1) + pad expected_result = code + (1, 0, 1, 1) + pad src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb(access_code, 0, "test") dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() self.assertEqual(expected_result, result_data)
def __init__(self, syncword_threshold=None, options=None): gr.hier_block2.__init__(self, 'lilacsat_1_deframer', gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(0, 0, 0)) options_block.__init__(self, options) self.message_port_register_hier_out('out') self.message_port_register_hier_out('codec2') if syncword_threshold is None: syncword_threshold = self.options.syncword_threshold self.delay1 = blocks.delay(gr.sizeof_float, 1) self.viterbi0 = ccsds_viterbi() self.viterbi1 = ccsds_viterbi() self.differential0 = digital.diff_decoder_bb(2) self.differential1 = digital.diff_decoder_bb(2) self.tag0 = digital.correlate_access_code_tag_bb( _syncword, syncword_threshold, 'syncword') self.tag1 = digital.correlate_access_code_tag_bb( _syncword, syncword_threshold, 'syncword') self.scrambler0 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key='syncword') self.scrambler1 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key='syncword') self.demux0 = lilacsat1_demux('syncword') self.demux1 = lilacsat1_demux('syncword') self.connect(self, self.viterbi0, self.differential0, self.tag0, self.scrambler0, self.demux0) self.connect(self, self.delay1, self.viterbi1, self.differential1, self.tag1, self.scrambler1, self.demux1) self.msg_connect((self.demux0, 'frame'), (self, 'out')) self.msg_connect((self.demux1, 'frame'), (self, 'out')) self.msg_connect((self.demux0, 'codec2'), (self, 'codec2')) self.msg_connect((self.demux1, 'codec2'), (self, 'codec2'))
def test_003(self): code = tuple(string_to_1_0_list(default_access_code)) access_code = to_1_0_string(code) pad = (0, ) * 64 #print code #print access_code src_data = code + (1, 0, 1, 1) + pad expected_result = code + (1, 0, 1, 1) + pad src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb(access_code, 0, "test") dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() self.assertEqual(expected_result, result_data)
def test_002(self): code = tuple(string_to_1_0_list(default_access_code)) access_code = to_1_0_string(code) pad = (0, ) * 64 #print code #print access_code src_data = code + (1, 0, 1, 1) + pad src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb(access_code, 0, "sync") dst = blocks.tag_debug(gr.sizeof_char, "sync") self.tb.connect(src, op, dst) self.tb.run() result_data = dst.current_tags() self.assertEqual(len(result_data), 1) self.assertEqual(result_data[0].offset, len(code))
def __init__(self, rate): #TODO pass in chanlist gr.hier_block2.__init__(self, "edacs_ctrl_rx", gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(0,0,0)) self.set_assign_callback(None) self._queue = gr.msg_queue() self._async_sender = gru.msgq_runner(self._queue, self.msg_handler) self._syms_per_sec = 9600. self._sps = rate / self._syms_per_sec self._demod = scanner.fsk_demod(self._sps, 0.575) self._invert = scanner.invert() self._sof = digital.correlate_access_code_tag_bb("010101010101010101010111000100100101010101010101", 0, "edacs_preamble") self._rx = scanner.edacs_pkt_rx(self._queue) self.connect(self, self._demod, self._invert, self._sof, self._rx)
def __init__(self, rate): #TODO pass in chanlist gr.hier_block2.__init__(self, "smartnet_ctrl_rx", gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(0,0,0)) self.set_assign_callback(None) self._queue = gr.msg_queue() self._async_sender = gru.msgq_runner(self._queue, self.msg_handler) self._syms_per_sec = 3600. self._sps = rate / self._syms_per_sec self._demod = scanner.fsk_demod(self._sps, 0.1) self._sof = digital.correlate_access_code_tag_bb("10101100", 0, "smartnet_preamble") self._deinterleave = scanner.deinterleave() self._crc = scanner.crc(self._queue) self.connect(self, self._demod, self._sof, self._deinterleave, self._crc)
def __init__(self): gr.top_block.__init__(self, "TW-1 test decoder") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.samp_per_sym = samp_per_sym = 10 self.gain_mu = gain_mu = 0.175*3 ################################################## # Blocks ################################################## self.synctags_fixedlen_tagger_0 = synctags.fixedlen_tagger("syncword", "packet_len", 256*8, numpy.byte) self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 2400, 2000, firdes.WIN_HAMMING, 6.76)) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x00, 16) self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb("10010011000010110101000111011110", 4, "syncword") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samp_per_sym*(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("/tmp/tw-1c.wav", False) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_len") self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(gr.sizeof_char*1, "packet_len", 1/8.0) self.blocks_message_debug_1 = blocks.message_debug() self.ax100_gomx3_rs_decode_0 = ax100.gomx3_rs_decode(True) ################################################## # Connections ################################################## self.msg_connect((self.ax100_gomx3_rs_decode_0, 'out'), (self.blocks_message_debug_1, 'print_pdu')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.ax100_gomx3_rs_decode_0, 'in')) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.synctags_fixedlen_tagger_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.synctags_fixedlen_tagger_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
def __init__(self, packlen=0, sync="00011010110011111111110000011101", threshold=4): gr.hier_block2.__init__( self, "Sync and create PDU", gr.io_signature(1, 1, gr.sizeof_char * 1), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out("out") ################################################## # Parameters ################################################## self.packlen = packlen self.sync = sync self.threshold = threshold ################################################## # Blocks ################################################## self.satellites_fixedlen_tagger_0_0_0 = satellites.fixedlen_tagger( 'syncword', 'packet_len', packlen, numpy.byte) self.digital_correlate_access_code_tag_bb_0_0_0 = digital.correlate_access_code_tag_bb( sync, threshold, 'syncword') self.blocks_tagged_stream_to_pdu_0_0_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self, 'out')) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0, 0), (self.satellites_fixedlen_tagger_0_0_0, 0)) self.connect((self, 0), (self.digital_correlate_access_code_tag_bb_0_0_0, 0)) self.connect((self.satellites_fixedlen_tagger_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0_0, 0))
def __init__(self, payload_width, synch): gr.hier_block2.__init__( self, "preamble_strip_2", gr.io_signature(1, 1, gr.sizeof_char), # Input signature gr.io_signature(1, 1, gr.sizeof_char)) # Output signature self.payload_width = payload_width self.synch = synch self.message_port_register_hier_out('packet_out') synch_string = ''.join(map(str, synch)) self.correlate = digital.correlate_access_code_tag_bb( synch_string, 0, "payload") self.extract = extract_tagged_payload_bb(payload_width, len(synch)) # Define blocks and connect them self.connect((self, 0), self.correlate) self.connect(self.correlate, self.extract) self.connect(self.extract, (self, 0)) self.msg_connect(self.extract, 'packet_out', self, 'packet_out')
def __init__(self, filter_width=96e3, rate=9600): gr.top_block.__init__(self, "Cc Sniffer") Qt.QWidget.__init__(self) self.setWindowTitle("Cc Sniffer") 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", "cc_sniffer") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.filter_width = filter_width self.rate = rate ################################################## # Variables ################################################## self.rs = rs = 1 self.threshold = threshold = 3 self.sps = sps = 5 self.source_rate = source_rate = 480e3 self.samp_rate = samp_rate = 48e3 self.raw_length = raw_length = 223+rs*32 self.qt_gui_freq_rx = qt_gui_freq_rx = 437.250 self.preamble = preamble = '101010101010101010101010101010' self.packet_length = packet_length = 223 self.offset_rx = offset_rx = 37000 self.freq_comp_rate = freq_comp_rate = 96e3 self.fll_bw = fll_bw = 40 self.fec = fec = 0 self.access_code_up = access_code_up = '11010010010110011101001001011001' self.access_code_down = access_code_down = '11010011100100011101001110010001' ################################################## # Blocks ################################################## self._qt_gui_freq_rx_tool_bar = Qt.QToolBar(self) self._qt_gui_freq_rx_tool_bar.addWidget(Qt.QLabel("Frequency RX"+": ")) self._qt_gui_freq_rx_line_edit = Qt.QLineEdit(str(self.qt_gui_freq_rx)) self._qt_gui_freq_rx_tool_bar.addWidget(self._qt_gui_freq_rx_line_edit) self._qt_gui_freq_rx_line_edit.returnPressed.connect( lambda: self.set_qt_gui_freq_rx(eng_notation.str_to_num(str(self._qt_gui_freq_rx_line_edit.text().toAscii())))) self.top_layout.addWidget(self._qt_gui_freq_rx_tool_bar) self._offset_rx_range = Range(-100e3, 100e3, 1e3, 37000, 200) self._offset_rx_win = RangeWidget(self._offset_rx_range, self.set_offset_rx, "Offset RX", "counter_slider", float) self.top_layout.addWidget(self._offset_rx_win) self._fll_bw_range = Range(5, 500, 5, 40, 200) self._fll_bw_win = RangeWidget(self._fll_bw_range, self.set_fll_bw, "FLL gain", "counter_slider", float) self.top_layout.addWidget(self._fll_bw_win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(source_rate) self.uhd_usrp_source_0.set_center_freq(qt_gui_freq_rx*1e6 - 50e3, 0) self.uhd_usrp_source_0.set_gain(65, 0) self.uhd_usrp_source_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=int(freq_comp_rate), decimation=int(source_rate), taps=None, fractional_bw=None, ) self.qtgui_sink_x_1_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc source_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_1_0.set_update_time(1.0/10) self._qtgui_sink_x_1_0_win = sip.wrapinstance(self.qtgui_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_1_0_win) self.qtgui_sink_x_1_0.enable_rf_freq(False) self.qtgui_sink_x_1 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 96000, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_1.set_update_time(1.0/10) self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_1_win) self.qtgui_sink_x_1.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0/10) self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.qtgui_number_sink_1 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_1.set_update_time(0.10) self.qtgui_number_sink_1.set_title("") labels = ["Frequency Shift", "", "", "", "", "", "", "", "", ""] units = ["Hz", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_1.set_min(i, -5000) self.qtgui_number_sink_1.set_max(i, 5000) self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_1.set_label(i, labels[i]) self.qtgui_number_sink_1.set_unit(i, units[i]) self.qtgui_number_sink_1.set_factor(i, factor[i]) self.qtgui_number_sink_1.enable_autoscale(False) self._qtgui_number_sink_1_win = sip.wrapinstance(self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_1_win) self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(int(freq_comp_rate/samp_rate), (firdes.low_pass(1, freq_comp_rate, rate*0.625, rate/20.0)), 0, freq_comp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1, source_rate, filter_width/2.0, filter_width/20.0)), 50e3 - offset_rx, source_rate) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=5, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(freq_comp_rate / rate, 0.35, 44, fll_bw*1e-3) self.digital_correlate_access_code_tag_bb_0_0_0 = digital.correlate_access_code_tag_bb(access_code_down, threshold, "syncword") self.digital_correlate_access_code_tag_bb_0_0 = digital.correlate_access_code_tag_bb(access_code_up, threshold, "syncword") self.cc_sdr_fixedlen_packet_synchronizer_0_0 = cc_sdr.fixedlen_packet_synchronizer("syncword", "packet_len", (raw_length + (1-rs)*2 + fec*(raw_length + 8)) * 8, numpy.byte) self.cc_sdr_fixedlen_packet_synchronizer_0 = cc_sdr.fixedlen_packet_synchronizer("syncword", "packet_len", (raw_length + (1-rs)*2 + fec*(raw_length + 8)) * 8, numpy.byte) self.cc_sdr_cc_decoder_0_0 = cc_sdr.cc_decoder(False, True, True, packet_length) self.cc_sdr_cc_decoder_0 = cc_sdr.cc_decoder(False, True, True, packet_length) self.blocks_unpacked_to_packed_xx_0_0_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.blocks_unpacked_to_packed_xx_0_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.blocks_tagged_stream_to_pdu_0_0_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_len") self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_len") self.blocks_tagged_stream_multiply_length_0_0_0 = blocks.tagged_stream_multiply_length(gr.sizeof_char*1, "packet_len", 1/8.0) self.blocks_tagged_stream_multiply_length_0_0 = blocks.tagged_stream_multiply_length(gr.sizeof_char*1, "packet_len", 1/8.0) self.blocks_socket_pdu_0_0_0 = blocks.socket_pdu("TCP_SERVER", "", "52002", packet_length, False) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("TCP_SERVER", "", "52001", packet_length, False) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((15278.876454, )) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0, 'pdus'), (self.cc_sdr_cc_decoder_0, 'in')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self.cc_sdr_cc_decoder_0_0, 'in')) self.msg_connect((self.cc_sdr_cc_decoder_0, 'out'), (self.blocks_socket_pdu_0_0, 'pdus')) self.msg_connect((self.cc_sdr_cc_decoder_0_0, 'out'), (self.blocks_socket_pdu_0_0_0, 'pdus')) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_number_sink_1, 0)) self.connect((self.blocks_tagged_stream_multiply_length_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0, 0)) self.connect((self.blocks_tagged_stream_multiply_length_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0, 0), (self.blocks_tagged_stream_multiply_length_0_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0_0, 0), (self.blocks_tagged_stream_multiply_length_0_0_0, 0)) self.connect((self.cc_sdr_fixedlen_packet_synchronizer_0, 0), (self.blocks_unpacked_to_packed_xx_0_0, 0)) self.connect((self.cc_sdr_fixedlen_packet_synchronizer_0_0, 0), (self.blocks_unpacked_to_packed_xx_0_0_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0, 0), (self.cc_sdr_fixedlen_packet_synchronizer_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0, 0), (self.cc_sdr_fixedlen_packet_synchronizer_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 3), (self.blocks_null_sink_0, 1)) self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.digital_correlate_access_code_tag_bb_0_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.digital_correlate_access_code_tag_bb_0_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_sink_x_1, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_sink_x_1_0, 0))
def __init__(self, parameter_0=0): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.parameter_0 = parameter_0 ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 ################################################## # Message Queues ################################################## adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue(2) adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 1090000000, #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 True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 256, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.010) self.qtgui_time_sink_x_0_0.set_y_axis(0, 1.2) 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_TAG, qtgui.TRIG_SLOPE_POS, .00001, .00002, 0, "adsb_preamble") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) 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 = ['pre', 'post', '', '', '', '', '', '', '', ''] 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_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_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 4,0,1,4) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 256, #size samp_rate, #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(-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(False) 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(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.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb('1010000101000000', 0, 'adsb_preamble') self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(4, 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_message_source_0 = blocks.message_source(gr.sizeof_char*1, blocks_message_source_0_msgq_in) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/zleffke/workspace/rocksat/2017/waveforms/captures/adsb_20161214_2M.32fc', True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/dev/stdout', False) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out) self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in,tx_msgq=adsb_decoder_0_msgq_out,output_type="hex",check_parity=False) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.adsb_framer_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.blocks_uchar_to_float_0, 0))
def __init__(self): gr.top_block.__init__(self, "Modes Uf Rx Sigmf Stream") Qt.QWidget.__init__(self) self.setWindowTitle("Modes Uf Rx Sigmf Stream") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "modes_uf_rx_sigmf_stream") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sps = sps = 4000000 self.samp_rate = samp_rate = 8000000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( 1.0, 1, 0.5, 0.25, 32) self.rf_gain = rf_gain = 45 self.qt_thresh = qt_thresh = 100 self.det_mult = det_mult = 2 self.det_avg_len = det_avg_len = 20 self.cons_offset = cons_offset = 5 self.burst_length = burst_length = 600 self.avg_len = avg_len = 20 ################################################## # Blocks ################################################## self._qt_thresh_tool_bar = Qt.QToolBar(self) self._qt_thresh_tool_bar.addWidget(Qt.QLabel("qt_thresh" + ": ")) self._qt_thresh_line_edit = Qt.QLineEdit(str(self.qt_thresh)) self._qt_thresh_tool_bar.addWidget(self._qt_thresh_line_edit) self._qt_thresh_line_edit.returnPressed.connect( lambda: self.set_qt_thresh( eng_notation.str_to_num( str(self._qt_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._qt_thresh_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._avg_len_tool_bar = Qt.QToolBar(self) self._avg_len_tool_bar.addWidget(Qt.QLabel("avg_len" + ": ")) self._avg_len_line_edit = Qt.QLineEdit(str(self.avg_len)) self._avg_len_tool_bar.addWidget(self._avg_len_line_edit) self._avg_len_line_edit.returnPressed.connect(lambda: self.set_avg_len( eng_notation.str_to_num( str(self._avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._avg_len_tool_bar, 0, 4, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.sigmf_source_0 = gr_sigmf.source( '/captures/adsb/20210127/MODE-S_2021-01-27T23:43:24.sigmf-data', "ci16" + ("_le" if sys.byteorder == "little" else "_be"), False) self._rf_gain_tool_bar = Qt.QToolBar(self) self._rf_gain_tool_bar.addWidget(Qt.QLabel("rf_gain" + ": ")) self._rf_gain_line_edit = Qt.QLineEdit(str(self.rf_gain)) self._rf_gain_tool_bar.addWidget(self._rf_gain_line_edit) self._rf_gain_line_edit.returnPressed.connect(lambda: self.set_rf_gain( eng_notation.str_to_num( str(self._rf_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( burst_length, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.010) self.qtgui_time_sink_x_1.set_y_axis(-5, 20) 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_AUTO, qtgui.TRIG_SLOPE_POS, qt_thresh, 1.0 / samp_rate * 100, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: 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(1): 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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 0, 2, 4) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( burst_length / 2 / 2 * 0 + 56, #size samp_rate / 2, #samp_rate "", #name 1 #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(-3, 3) 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_TAG, qtgui.TRIG_SLOPE_POS, 0, 1.0 / (samp_rate / 2) * 10, 0, "P1_P2") self.qtgui_time_sink_x_0_0.enable_autoscale(True) 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) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not False: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['chips', 'bits', '', '', '', '', '', '', '', ''] 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 = [0, -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.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_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 3, 3, 2, 4) for r in range(3, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 7): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( burst_length / 2, #size samp_rate / 2, #samp_rate "soft chips", #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(-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_TAG, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "es::event_type") self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(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 = [0, -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.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 3, 0, 2, 3) for r in range(3, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 3): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( burst_length / 2, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.010) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(True) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 8, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 10): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 3e6, 250e3, firdes.WIN_BLACKMAN, 6.76)) self.fosphor_glfw_sink_c_0 = fosphor.glfw_sink_c() self.fosphor_glfw_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_glfw_sink_c_0.set_frequency_range(0, samp_rate) self.digital_diff_decoder_bb_1 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0 = digital.costas_loop_cc( math.pi / 50, 2, False) self.digital_correlate_access_code_tag_xx_0_0_1_2_2 = digital.correlate_access_code_tag_bb( '10010000100100100001', 2, 'sync') self.digital_correlate_access_code_tag_xx_0_0_1_2 = digital.correlate_access_code_tag_bb( '11100000111000', 1, 'P1_P2') self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_cc( 2, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_2 = digital.binary_slicer_fb() self._det_mult_tool_bar = Qt.QToolBar(self) self._det_mult_tool_bar.addWidget(Qt.QLabel("det_mult" + ": ")) self._det_mult_line_edit = Qt.QLineEdit(str(self.det_mult)) self._det_mult_tool_bar.addWidget(self._det_mult_line_edit) self._det_mult_line_edit.returnPressed.connect( lambda: self.set_det_mult( eng_notation.str_to_num( str(self._det_mult_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_mult_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._det_avg_len_tool_bar = Qt.QToolBar(self) self._det_avg_len_tool_bar.addWidget(Qt.QLabel("det_avg_len" + ": ")) self._det_avg_len_line_edit = Qt.QLineEdit(str(self.det_avg_len)) self._det_avg_len_tool_bar.addWidget(self._det_avg_len_line_edit) self._det_avg_len_line_edit.returnPressed.connect( lambda: self.set_det_avg_len( int(str(self._det_avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_avg_len_tool_bar, 0, 9, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(9, 10): self.top_grid_layout.setColumnStretch(c, 1) self.dc_blocker_xx_0 = filter.dc_blocker_ff(4, True) self._cons_offset_tool_bar = Qt.QToolBar(self) self._cons_offset_tool_bar.addWidget(Qt.QLabel("cons_offset" + ": ")) self._cons_offset_line_edit = Qt.QLineEdit(str(self.cons_offset)) self._cons_offset_tool_bar.addWidget(self._cons_offset_line_edit) self._cons_offset_line_edit.returnPressed.connect( lambda: self.set_cons_offset( eng_notation.str_to_num( str(self._cons_offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._cons_offset_tool_bar, 0, 8, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 9): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_multiply_const_xx_0 = blocks.multiply_const_cc(1.0 / 65536.0) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( int(avg_len), 1.0 / avg_len, 4000, 1) self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex( True, False) self.blocks_complex_to_real_1 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) self.blocks_add_const_vxx_1 = blocks.add_const_vff((1, )) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_real_1, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_complex_to_real_1, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_interleaved_short_to_complex_0, 0), (self.blocks_multiply_const_xx_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_multiply_const_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_binary_slicer_fb_2, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.digital_binary_slicer_fb_2, 0), (self.digital_correlate_access_code_tag_xx_0_0_1_2, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0_0_1_2, 0), (self.digital_diff_decoder_bb_1, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0_0_1_2_2, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.blocks_complex_to_real_1, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_diff_decoder_bb_1, 0), (self.digital_correlate_access_code_tag_xx_0_0_1_2_2, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fosphor_glfw_sink_c_0, 0)) self.connect((self.sigmf_source_0, 0), (self.blocks_interleaved_short_to_complex_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Keyfob Rx") ################################################## # Variables ################################################## self.sps = sps = 5 self.samp_rate = samp_rate = 48000 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400 * 5, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 3393.75*sps/1000000.026491, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.osmosdr_source_0.set_sample_rate(1000000) self.osmosdr_source_0.set_center_freq(434400000, 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(2, 0) self.osmosdr_source_0.set_if_gain(0, 0) self.osmosdr_source_0.set_bb_gain(0, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.keyfob_parse_packet_0 = keyfob.parse_packet() self.keyfob_manchester_decode_0 = keyfob.manchester_decode() self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb("10101000", 0, "packet_start") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.05) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_moving_average_xx_1 = blocks.moving_average_ff(sps, 1.0/sps, 4000) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(10000, 1.0/10000, 4000) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_moving_average_xx_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.keyfob_manchester_decode_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.wxgui_scopesink2_1, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.keyfob_parse_packet_0, 0)) self.connect((self.keyfob_manchester_decode_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_moving_average_xx_1, 0))
def __init__(self): gr.top_block.__init__(self, "Gen Data Psk") Qt.QWidget.__init__(self) self.setWindowTitle("Gen Data Psk") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "gen_data_psk") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.tx_message = tx_message = "This is a message from the FD radio" self.tx_pay_len = tx_pay_len = len(tx_message) + len(' (000000000)\n') self.tx_access_code = tx_access_code = "0011110011100011000001111111" self.sps = sps = 2 self.signal_scope = signal_scope = 200 self.samp_rate = samp_rate = 10e6 self.file_usrp_in = file_usrp_in = "usrp_in" self.constellation = constellation = 4 self.bits_scope = bits_scope = 200 ################################################## # 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, 'Bits') 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, 'Signals Time') 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, 'Signals Freq') self.top_layout.addWidget(self.tab) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( signal_scope, #size samp_rate, #samp_rate "", #name 1 #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(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(True) 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", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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.tab_layout_1.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( bits_scope, #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_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0.2 * bits_scope / samp_rate, 0, 'usrp_input') self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(True) 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.tab_layout_0.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #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(-140, 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(True) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(True) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_layout_2.addWidget(self._qtgui_freq_sink_x_0_win) self.func_self_msg = func_self_msg.tx_fd_message(message=tx_message) self.func_print_msg = func_print_msg.print_fd_message(display=1) self.digital_psk_mod_0 = digital.psk.psk_mod( constellation_points=constellation, mod_code="gray", differential=True, samples_per_symbol=sps, excess_bw=0.35, verbose=False, log=False, ) self.digital_psk_demod_0_0 = digital.psk.psk_demod( constellation_points=constellation, differential=True, samples_per_symbol=sps, excess_bw=0.35, phase_bw=6.28 / 100.0, timing_bw=6.28 / 100.0, mod_code="gray", verbose=False, log=False, ) self.digital_correlate_access_code_tag_bb_0_0_0 = digital.correlate_access_code_tag_bb( tx_access_code, 0, 'usrp_input') self.blocks_throttle_0_0_0_0_0 = blocks.throttle( gr.sizeof_char * 1, samp_rate, True) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.3, )) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, file_usrp_in, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b( grc_blks2.packet_encoder( samples_per_symbol=1, bits_per_symbol=1, preamble='', access_code=tx_access_code, pad_for_usrp=False, ), payload_length=tx_pay_len, ) self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b( grc_blks2.packet_decoder( access_code=tx_access_code, threshold=0, callback=lambda ok, payload: self.blks2_packet_decoder_0. recv_pkt(ok, payload), ), ) ################################################## # Connections ################################################## self.connect((self.blks2_packet_decoder_0, 0), (self.func_print_msg, 0)) self.connect((self.blks2_packet_encoder_0_0, 0), (self.digital_psk_mod_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.digital_psk_demod_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_throttle_0_0_0_0_0, 0), (self.blks2_packet_encoder_0_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_psk_demod_0_0, 0), (self.blks2_packet_decoder_0, 0)) self.connect((self.digital_psk_demod_0_0, 0), (self.digital_correlate_access_code_tag_bb_0_0_0, 0)) self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.func_self_msg, 0), (self.blocks_throttle_0_0_0_0_0, 0))
def __init__(self, dc_block_len=4, rx_gain=40): gr.top_block.__init__(self, "Uhd Adsb 6") ################################################## # Parameters ################################################## self.dc_block_len = dc_block_len self.rx_gain = rx_gain ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 self.freq = freq = 1090e6 self.filename = filename = "./bytes_" + str(dc_block_len) + ".csv" ################################################## # Message Queues ################################################## adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue( 2) adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, samp_rate / 2), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_auto_dc_offset("", 0) self.uhd_usrp_source_0.set_auto_iq_balance("", 0) self.digital_correlate_access_code_tag_xx_0 = digital.correlate_access_code_tag_bb( '1010000101000000', 0, 'adsb_preamble') self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_len, True) self.blocks_message_source_0 = blocks.message_source( gr.sizeof_char * 1, blocks_message_source_0_msgq_in) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, filename, True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out) self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in, tx_msgq=adsb_decoder_0_msgq_out, output_type="csv", check_parity=True) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_tag_xx_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.adsb_framer_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
def __init__(self,len_tag_key, samp_rate, enable_crc): gr.hier_block2.__init__(self, "frame_decoder", gr.io_signature(1, 1, gr.sizeof_char), # Input signature gr.io_signature(1, 1, gr.sizeof_char)) # Output signature self.len_tag_key = len_tag_key self.samp_rate = samp_rate # Set correlator. FIXME Modifiable access code self.digital_correlate_access_code_tag_bb_0 \ = digital.correlate_access_code_tag_bb( "1010110011011101101001001110001011110010100011000010000011111100", 0, "access") self.digital_header_payload_demux_0 = digital.header_payload_demux( 32, # header size 1, # bits per symbol 0, # guard interval len_tag_key, # length tag key "access", # trigger tag key False, # no idea gr.sizeof_char, # item format "rx_time", # timing tag key (irrelevant) samp_rate, # sample rate (""), # special tag keys ) self.digital_packet_headerparser_b_default_0 \ = digital.packet_headerparser_b(32, len_tag_key) self.blocks_repack_bits_bb_0 \ = blocks.repack_bits_bb(1, 8, len_tag_key, False, gr.GR_MSB_FIRST) if enable_crc: self.digital_crc32_bb_0 \ = digital.crc32_bb(True, len_tag_key, True) # Debug self.tag_debug_correlator = blocks.tag_debug(gr.sizeof_char*1, "Access code found.", "access"); #self.tag_debug_header = blocks.tag_debug(gr.sizeof_char*1, # "Header correctly obtained", len_tag_key); self.tag_debug_packet = blocks.tag_debug(gr.sizeof_char*1, "Packet correctly obtained.", len_tag_key); # Debug Message after the header was found #self.blocks_message_debug_0 = blocks.message_debug() #self.blocks_tagged_stream_to_pdu_0 \ # = blocks.tagged_stream_to_pdu(blocks.byte_t, len_tag_key) # PDU Tag Multiplier self.multiplay_length = orcatun.multiply_length_pdu(len_tag_key) ################################################## # Connections ################################################## # Correlator to Header/Payload Demux # Correlator triggers the HPD with stream tags self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.digital_header_payload_demux_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.tag_debug_correlator,0)) # HPD to Header Parser # Extracts the information from the header... self.connect((self.digital_header_payload_demux_0, 0), (self.digital_packet_headerparser_b_default_0, 0)) # ... and pass it back to the HPD #self.msg_connect((self.digital_packet_headerparser_b_default_0, # 'header_data'), # (self.digital_header_payload_demux_0, # 'header_data')) self.msg_connect((self.digital_packet_headerparser_b_default_0, 'header_data'), (self.multiplay_length, 'in')) self.msg_connect((self.multiplay_length, 'out'), (self.digital_header_payload_demux_0, 'header_data')) # HPD payload to Repacker self.connect((self.digital_header_payload_demux_0, 1), (self.blocks_repack_bits_bb_0, 0)) # Repacker to Stream CRC32 # to check the CRC if enable_crc: self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_crc32_bb_0, 0)) # Connect input and output self.connect((self,0), (self.digital_correlate_access_code_tag_bb_0, 0)) if enable_crc: self.connect((self.digital_crc32_bb_0, 0), (self,0)) else: self.connect((self.blocks_repack_bits_bb_0, 0), (self,0)) # Debug if enable_crc: self.connect((self.digital_crc32_bb_0, 0), (self.tag_debug_packet, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Keyfob Decode Wav") ################################################## # Variables ################################################## self.sps = sps = 5 self.samp_rate = samp_rate = 48000 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400 * 5, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff(3400.0 * sps / 48000, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.keyfob_parse_packet_0 = keyfob.parse_packet() self.keyfob_manchester_decode_0 = keyfob.manchester_decode() self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb( "10101000", 0, "packet_start") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( 5 * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.05) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source( "../gqrx_20150306_154200_434400000.wav", False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate * 3, True) self.blocks_moving_average_xx_1 = blocks.moving_average_ff( sps, 1, 4000) ################################################## # Connections ################################################## self.connect((self.blocks_moving_average_xx_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.pfb_arb_resampler_xxx_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.keyfob_manchester_decode_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.wxgui_scopesink2_1, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.keyfob_parse_packet_0, 0)) self.connect((self.keyfob_manchester_decode_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_moving_average_xx_1, 0))
def __init__(self, bfo=12000, ip='127.0.0.1', port=7355, recstart=''): gr.top_block.__init__(self, "Taurus-1 decoder") Qt.QWidget.__init__(self) self.setWindowTitle("Taurus-1 decoder") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "taurus1") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Parameters ################################################## self.bfo = bfo self.ip = ip self.port = port self.recstart = recstart ################################################## # Variables ################################################## self.sps = sps = 5 self.samp_per_sym = samp_per_sym = 5 self.nfilts = nfilts = 16 self.alpha = alpha = 0.35 self.variable_constellation_0 = variable_constellation_0 = digital.constellation_calcdist( ([-1, 1]), ([0, 1]), 2, 1).base() self.threshold = threshold = 3 self.samp_rate = samp_rate = 48000 self.rrc_taps_0 = rrc_taps_0 = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(samp_per_sym), 0.35, 11 * samp_per_sym * nfilts) self.rrc_taps = rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0 / float(sps), alpha, 11 * sps * nfilts) self.nfilts_0 = nfilts_0 = 16 self.equalizer_gain = equalizer_gain = 0.05 self.af_gain = af_gain = 0 ################################################## # Blocks ################################################## self._equalizer_gain_range = Range(0.0, 0.2, 0.01, 0.05, 200) self._equalizer_gain_win = RangeWidget(self._equalizer_gain_range, self.set_equalizer_gain, 'Equalizer: Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._equalizer_gain_win) self._af_gain_tool_bar = Qt.QToolBar(self) self._af_gain_tool_bar.addWidget(Qt.QLabel('AF Gain' + ": ")) self._af_gain_line_edit = Qt.QLineEdit(str(self.af_gain)) self._af_gain_tool_bar.addWidget(self._af_gain_line_edit) self._af_gain_line_edit.returnPressed.connect(lambda: self.set_af_gain( eng_notation.str_to_num( str(self._af_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._af_gain_tool_bar) self.satellites_taurus1_telemetry_parser_0 = satellites.taurus1_telemetry_parser( ) self.satellites_submit_0 = satellites.submit( 'https://db.satnogs.org/api/telemetry/', 44530, 'AD7NP', -122.2084, 47.6458, recstart) self.satellites_print_timestamp_0 = satellites.print_timestamp( '%Y-%m-%d %H:%M:%S', True) self.satellites_lilacsat1_demux_0_0 = satellites.lilacsat1_demux( "syncword") self.satellites_lilacsat1_demux_0 = satellites.lilacsat1_demux( "syncword") self.satellites_kiss_to_pdu_1 = satellites.kiss_to_pdu(False) self.rms_agc_0 = rms_agc( alpha=1e-2, reference=0.5, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=6, decimation=1, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1000, #size 8000, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.125) 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(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(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_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['A', 'B', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 6000, 500, firdes.WIN_HAMMING, 6.76)) self.lilacsat_vitfilt27_fb_0_0 = lilacsat.vitfilt27_fb() self.lilacsat_vitfilt27_fb_0 = lilacsat.vitfilt27_fb() self.lilacsat_sync_det_b_0_0 = lilacsat.sync_det_b( 0x1ACFFC1D, 116, True, True) self.lilacsat_sync_det_b_0 = lilacsat.sync_det_b( 0x1ACFFC1D, 116, True, True) self.lilacsat_lilacsat1_frame_depack_0 = lilacsat.lilacsat1_frame_depack( ) (self.lilacsat_lilacsat1_frame_depack_0).set_max_output_buffer(512) self.lilacsat_codec2_decode_bf_0 = lilacsat.codec2_decode_bf(0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf( 1, (firdes.low_pass(1, samp_rate, 10000, 1000)), bfo, samp_rate) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( sps, 0.05, (rrc_taps), nfilts, nfilts / 2, 0.01, 1) self.digital_lms_dd_equalizer_cc_0_0 = digital.lms_dd_equalizer_cc( 2, equalizer_gain, 2, variable_constellation_0) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( sps, 0.350, 100, 0.01) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(2) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(0.1, 2, False) self.digital_correlate_access_code_tag_bb_0_0_0_0_0 = digital.correlate_access_code_tag_bb( "00011010110011111111110000011101", threshold, "syncword") self.digital_correlate_access_code_tag_bb_0_0_0_0 = digital.correlate_access_code_tag_bb( "00011010110011111111110000011101", threshold, "syncword") self.digital_additive_scrambler_bb_0_0_0_0 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key="syncword") self.digital_additive_scrambler_bb_0_0_0 = digital.additive_scrambler_bb( 0xA9, 0xFF, 7, count=0, bits_per_byte=1, reset_tag_key="syncword") self.ccsds_viterbi_0_0 = ccsds_viterbi() self.ccsds_viterbi_0 = ccsds_viterbi() self.blocks_unpacked_to_packed_xx_0_0_0_0_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_unpacked_to_packed_xx_0_0_0_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_unpack_k_bits_bb_0_0_0_1 = blocks.unpack_k_bits_bb(8) self.blocks_unpack_k_bits_bb_0_0_0 = blocks.unpack_k_bits_bb(8) self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1, ip, port, 1472, False) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1, '127.0.0.1', 7000, 7, False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, 8000, True) self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767) self.blocks_pdu_to_tagged_stream_1_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (10.0**(af_gain / 20.0), )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, )) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float * 1, 1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 1) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_source_0 = audio.source(8000, '', True) self.audio_sink_0 = audio.sink(48000, '', True) ################################################## # Connections ################################################## self.msg_connect((self.lilacsat_lilacsat1_frame_depack_0, 'out'), (self.blocks_message_debug_0, 'store')) self.msg_connect((self.lilacsat_sync_det_b_0, 'out'), (self.lilacsat_lilacsat1_frame_depack_0, 'in')) self.msg_connect((self.lilacsat_sync_det_b_0_0, 'out'), (self.lilacsat_lilacsat1_frame_depack_0, 'in')) self.msg_connect((self.satellites_kiss_to_pdu_1, 'out'), (self.satellites_print_timestamp_0, 'in')) self.msg_connect((self.satellites_kiss_to_pdu_1, 'out'), (self.satellites_submit_0, 'in')) self.msg_connect((self.satellites_lilacsat1_demux_0, 'kiss'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.satellites_lilacsat1_demux_0, 'codec2'), (self.blocks_pdu_to_tagged_stream_1_0, 'pdus')) self.msg_connect((self.satellites_lilacsat1_demux_0_0, 'kiss'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.satellites_lilacsat1_demux_0_0, 'codec2'), (self.blocks_pdu_to_tagged_stream_1_0, 'pdus')) self.msg_connect((self.satellites_print_timestamp_0, 'out'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.satellites_print_timestamp_0, 'out'), (self.satellites_taurus1_telemetry_parser_0, 'in')) self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.ccsds_viterbi_0, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.lilacsat_vitfilt27_fb_0, 0)) self.connect((self.blocks_delay_0, 0), (self.ccsds_viterbi_0_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.lilacsat_vitfilt27_fb_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.blocks_unpacked_to_packed_xx_0_0_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1_0, 0), (self.blocks_unpacked_to_packed_xx_0_0_0_0_0, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_udp_source_0, 0), (self.blocks_short_to_float_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0_0_0, 0), (self.lilacsat_sync_det_b_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0_0_0_1, 0), (self.lilacsat_sync_det_b_0_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0_0_0, 0), (self.satellites_kiss_to_pdu_1, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0_0_0_0_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.ccsds_viterbi_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.ccsds_viterbi_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0)) self.connect((self.digital_additive_scrambler_bb_0_0_0, 0), (self.satellites_lilacsat1_demux_0, 0)) self.connect((self.digital_additive_scrambler_bb_0_0_0_0, 0), (self.satellites_lilacsat1_demux_0_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0_0, 0), (self.digital_additive_scrambler_bb_0_0_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0_0_0_0_0, 0), (self.digital_additive_scrambler_bb_0_0_0_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.digital_lms_dd_equalizer_cc_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_correlate_access_code_tag_bb_0_0_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0_0, 0), (self.digital_correlate_access_code_tag_bb_0_0_0_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_lms_dd_equalizer_cc_0_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rms_agc_0, 0)) self.connect((self.lilacsat_codec2_decode_bf_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.lilacsat_codec2_decode_bf_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.lilacsat_lilacsat1_frame_depack_0, 0), (self.lilacsat_codec2_decode_bf_0, 0)) self.connect((self.lilacsat_vitfilt27_fb_0, 0), (self.blocks_unpack_k_bits_bb_0_0_0, 0)) self.connect((self.lilacsat_vitfilt27_fb_0_0, 0), (self.blocks_unpack_k_bits_bb_0_0_0_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.rms_agc_0, 0), (self.digital_fll_band_edge_cc_0, 0))
def __init__(self): gr.top_block.__init__(self, "Modes Uf Rx Sigmf V2") Qt.QWidget.__init__(self) self.setWindowTitle("Modes Uf Rx Sigmf V2") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "modes_uf_rx_sigmf_v2") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.sps = sps = 2 self.samp_rate = samp_rate = 8000000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( 1, 1, 0.5, 0.4, 32) self.rms_alpha = rms_alpha = 1e-6 self.rf_gain = rf_gain = 45 self.qt_thresh = qt_thresh = 110 self.es_thresh = es_thresh = 110 self.det_mult = det_mult = 2 self.det_avg_len = det_avg_len = 20 self.cons_offset = cons_offset = 5 self.burst_length = burst_length = 600 self.bit_thresh = bit_thresh = 5 self.avg_len = avg_len = 20 ################################################## # Blocks ################################################## self._rms_alpha_tool_bar = Qt.QToolBar(self) self._rms_alpha_tool_bar.addWidget(Qt.QLabel("rms_alpha" + ": ")) self._rms_alpha_line_edit = Qt.QLineEdit(str(self.rms_alpha)) self._rms_alpha_tool_bar.addWidget(self._rms_alpha_line_edit) self._rms_alpha_line_edit.returnPressed.connect( lambda: self.set_rms_alpha( eng_notation.str_to_num( str(self._rms_alpha_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rms_alpha_tool_bar, 6, 3, 1, 1) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._qt_thresh_tool_bar = Qt.QToolBar(self) self._qt_thresh_tool_bar.addWidget(Qt.QLabel("qt_thresh" + ": ")) self._qt_thresh_line_edit = Qt.QLineEdit(str(self.qt_thresh)) self._qt_thresh_tool_bar.addWidget(self._qt_thresh_line_edit) self._qt_thresh_line_edit.returnPressed.connect( lambda: self.set_qt_thresh( eng_notation.str_to_num( str(self._qt_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._qt_thresh_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._es_thresh_tool_bar = Qt.QToolBar(self) self._es_thresh_tool_bar.addWidget(Qt.QLabel('ES Thresh' + ": ")) self._es_thresh_line_edit = Qt.QLineEdit(str(self.es_thresh)) self._es_thresh_tool_bar.addWidget(self._es_thresh_line_edit) self._es_thresh_line_edit.returnPressed.connect( lambda: self.set_es_thresh( eng_notation.str_to_num( str(self._es_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._es_thresh_tool_bar, 0, 5, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._det_mult_tool_bar = Qt.QToolBar(self) self._det_mult_tool_bar.addWidget(Qt.QLabel("det_mult" + ": ")) self._det_mult_line_edit = Qt.QLineEdit(str(self.det_mult)) self._det_mult_tool_bar.addWidget(self._det_mult_line_edit) self._det_mult_line_edit.returnPressed.connect( lambda: self.set_det_mult( eng_notation.str_to_num( str(self._det_mult_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_mult_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._det_avg_len_tool_bar = Qt.QToolBar(self) self._det_avg_len_tool_bar.addWidget(Qt.QLabel("det_avg_len" + ": ")) self._det_avg_len_line_edit = Qt.QLineEdit(str(self.det_avg_len)) self._det_avg_len_tool_bar.addWidget(self._det_avg_len_line_edit) self._det_avg_len_line_edit.returnPressed.connect( lambda: self.set_det_avg_len( int(str(self._det_avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._det_avg_len_tool_bar, 0, 9, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(9, 10): self.top_grid_layout.setColumnStretch(c, 1) self._cons_offset_tool_bar = Qt.QToolBar(self) self._cons_offset_tool_bar.addWidget(Qt.QLabel("cons_offset" + ": ")) self._cons_offset_line_edit = Qt.QLineEdit(str(self.cons_offset)) self._cons_offset_tool_bar.addWidget(self._cons_offset_line_edit) self._cons_offset_line_edit.returnPressed.connect( lambda: self.set_cons_offset( eng_notation.str_to_num( str(self._cons_offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._cons_offset_tool_bar, 0, 8, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 9): self.top_grid_layout.setColumnStretch(c, 1) self._avg_len_tool_bar = Qt.QToolBar(self) self._avg_len_tool_bar.addWidget(Qt.QLabel("avg_len" + ": ")) self._avg_len_line_edit = Qt.QLineEdit(str(self.avg_len)) self._avg_len_tool_bar.addWidget(self._avg_len_line_edit) self._avg_len_line_edit.returnPressed.connect(lambda: self.set_avg_len( eng_notation.str_to_num( str(self._avg_len_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._avg_len_tool_bar, 0, 4, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.vcc_es_tag_to_utc_0 = vcc.es_tag_to_utc(samp_rate) self.vcc_burst_snr_0 = vcc.burst_snr(25, 2) self.sigmf_source_0 = gr_sigmf.source( '/captures/adsb/20210127/MODE-S_2021-01-27T23:43:24.sigmf-data', "ci16" + ("_le" if sys.byteorder == "little" else "_be"), False) self._rf_gain_tool_bar = Qt.QToolBar(self) self._rf_gain_tool_bar.addWidget(Qt.QLabel("rf_gain" + ": ")) self._rf_gain_line_edit = Qt.QLineEdit(str(self.rf_gain)) self._rf_gain_tool_bar.addWidget(self._rf_gain_line_edit) self._rf_gain_line_edit.returnPressed.connect(lambda: self.set_rf_gain( eng_notation.str_to_num( str(self._rf_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( burst_length / 2, #size samp_rate, #samp_rate "", #name 3 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.010) self.qtgui_time_sink_x_1.set_y_axis(-5, 20) 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_AUTO, qtgui.TRIG_SLOPE_POS, qt_thresh, 1.0 / samp_rate * 100, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(True) 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) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: 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(3): 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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 0, 2, 4) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( burst_length / 2, #size samp_rate / 2, #samp_rate "soft chips", #name 3 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "es::event_type") self.qtgui_time_sink_x_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_1.enable_grid(False) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(False) self.qtgui_time_sink_x_0_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_1.disable_legend() labels = ['re', 'abs', 'mag', 'ph', '', '', '', '', '', ''] 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, 2, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -1, 0, -1, -1, -1, -1, -1, -1, -1] alphas = [1, 0.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(3): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_1_win, 3, 0, 3, 5) for r in range(3, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 5): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( samp_rate / 2, 20, 56, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_raster_sink_x_0_win, 3, 5, 3, 5) for r in range(3, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 10): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( burst_length / 2, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.010) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(True) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 8, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(8, 10): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0 self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 1, 4, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.pyqt_const_plot_0 = pyqt.const_plot(label='') self._pyqt_const_plot_0_win = self.pyqt_const_plot_0 self.top_grid_layout.addWidget(self._pyqt_const_plot_0_win, 1, 6, 2, 2) for r in range(1, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 4e6, 250e3, firdes.WIN_BLACKMAN, 6.76)) self.fosphor_glfw_sink_c_0 = fosphor.glfw_sink_c() self.fosphor_glfw_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_glfw_sink_c_0.set_frequency_range(0, samp_rate) self.es_trigger_edge_f_0 = es.trigger_edge_f(es_thresh, burst_length, burst_length / 3, gr.sizeof_gr_complex, 300) self.es_sink_0 = es.sink(1 * [gr.sizeof_gr_complex], 4, 64, 0, 2, 0) self.es_handler_pdu_0 = es.es_make_handler_pdu( es.es_handler_print.TYPE_C32) self.epy_block_1 = epy_block_1.uf_frame_sync(tag_name='sync', msg_len=112, samp_rate=samp_rate, sps=2) self.epy_block_0_0 = epy_block_0_0.uf_decode(msg_filter='All Messages', verbose=True) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( 2, math.pi / 200, (rrc_taps), 32, 16, 1.1, 1) self.digital_diff_phasor_cc_0 = digital.diff_phasor_cc() self.digital_costas_loop_cc_0 = digital.costas_loop_cc( math.pi / 50, 2, False) self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0 = digital.correlate_access_code_tag_bb( '00011111000111000001', 3, 'sync') self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * 2, True) self.blocks_sub_xx_2_0 = blocks.sub_ff(1) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float * 1, 1) self.blocks_rms_xx_1 = blocks.rms_cf(rms_alpha) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.byte_t, 'packet_len') self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'est_len') (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(600) self.blocks_pdu_remove_0 = blocks.pdu_remove( pmt.intern("es::event_buffer")) self.blocks_multiply_const_xx_0 = blocks.multiply_const_cc(1.0 / 65536.0) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (-1 * det_mult, )) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff( int(det_avg_len), 1.0 / det_avg_len, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( int(avg_len), 1.0 / avg_len, 4000, 1) self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex( True, False) self.blocks_complex_to_real_1_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1 / 10.0) self.blocks_add_const_vxx_0 = blocks.add_const_vff((cons_offset, )) self.blocks_abs_xx_0 = blocks.abs_ff(1) self._bit_thresh_tool_bar = Qt.QToolBar(self) self._bit_thresh_tool_bar.addWidget(Qt.QLabel("bit_thresh" + ": ")) self._bit_thresh_line_edit = Qt.QLineEdit(str(self.bit_thresh)) self._bit_thresh_tool_bar.addWidget(self._bit_thresh_line_edit) self._bit_thresh_line_edit.returnPressed.connect( lambda: self.set_bit_thresh( eng_notation.str_to_num( str(self._bit_thresh_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._bit_thresh_tool_bar, 6, 4, 1, 1) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self.ais_invert_0 = ais.invert() ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.vcc_burst_snr_0, 'in')) self.msg_connect((self.epy_block_0_0, 'out'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.msg_connect((self.epy_block_1, 'out'), (self.epy_block_0_0, 'in')) self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus')) self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event')) self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event')) self.msg_connect((self.vcc_burst_snr_0, 'out'), (self.vcc_es_tag_to_utc_0, 'in')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.pyqt_const_plot_0, 'cpdus')) self.msg_connect((self.vcc_es_tag_to_utc_0, 'out'), (self.pyqt_ctime_plot_0, 'cpdus')) self.connect( (self.ais_invert_0, 0), (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.es_trigger_edge_f_0, 1)) self.connect((self.analog_agc2_xx_0, 0), (self.fosphor_glfw_sink_c_0, 0)) self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_time_sink_x_1, 2)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_0_1, 2)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.qtgui_time_sink_x_1, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_real_1_0_0, 0), (self.blocks_sub_xx_2_0, 0)) self.connect((self.blocks_complex_to_real_1_0_0, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_interleaved_short_to_complex_0, 0), (self.blocks_multiply_const_xx_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.es_trigger_edge_f_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.blocks_rms_xx_1, 0), (self.blocks_sub_xx_2_0, 1)) self.connect((self.blocks_rms_xx_1, 0), (self.qtgui_time_sink_x_0_1, 1)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0)) self.connect((self.blocks_sub_xx_2_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.ais_invert_0, 0)) self.connect( (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect( (self.digital_correlate_access_code_tag_xx_0_0_1_2_2_0_0_0, 0), (self.epy_block_1, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_diff_phasor_cc_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_diff_phasor_cc_0, 0), (self.blocks_complex_to_real_1_0_0, 0)) self.connect((self.digital_diff_phasor_cc_0, 0), (self.blocks_rms_xx_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.sigmf_source_0, 0), (self.blocks_interleaved_short_to_complex_0, 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): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") 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", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 self.intermediate_samp_rate = intermediate_samp_rate = samp_rate self.top_block_fournisseur = top_block_fournisseur = 0 self.sps = sps = int(intermediate_samp_rate/1e6) self.nfilts = nfilts = 32 self.f_deviation = f_deviation = 1e6 self.channel = channel = 13 ################################################## # Blocks ################################################## self._channel_range = Range(0, 100, 1, 13, 1) self._channel_win = RangeWidget(self._channel_range, self.set_channel, "channel", "counter_slider", int) self.top_layout.addWidget(self._channel_win) self.chan_change = chan_change.blk(param="self") self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(((channel+1) * 1e6) + 2.4e9, 0) self.uhd_usrp_source_0.set_normalized_gain(1, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) def _top_block_fournisseur_probe(): while True: val = self.chan_change.set_top_block(self) try: self.set_top_block_fournisseur(val) except AttributeError: pass time.sleep(1.0 / (1)) _top_block_fournisseur_thread = threading.Thread(target=_top_block_fournisseur_probe) _top_block_fournisseur_thread.daemon = True _top_block_fournisseur_thread.start() self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f( 12000, #size 1e6, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_1_1.set_update_time(0.10) self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 1.5, .0001, 0, "PreambleFound") self.qtgui_time_sink_x_1_1.enable_autoscale(False) self.qtgui_time_sink_x_1_1.enable_grid(False) self.qtgui_time_sink_x_1_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_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_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_1_win) self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f( int(12240.0*sps/8.0), #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0.set_update_time(0.10) self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_0.enable_tags(-1, True) self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 1.5, 0, 0, "Found") self.qtgui_time_sink_x_1_0.enable_autoscale(False) self.qtgui_time_sink_x_1_0.enable_grid(False) self.qtgui_time_sink_x_1_0.enable_axis_labels(True) self.qtgui_time_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1_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_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.dsmx_preambleDetection_0 = dsmx.preambleDetection(channel) self.dsmx_Despreader_0 = dsmx.Despreader() self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb('1100110011001100110011001100110011001100110011001100110011001100', 8, 'PreambleFound') self.digital_clock_recovery_mm_xx_1 = digital.clock_recovery_mm_ff(sps, 1, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb() self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1) self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.msg_connect((self.dsmx_Despreader_0, 'pdus'), (self.chan_change, 'ChannelChange')) self.msg_connect((self.dsmx_preambleDetection_0, 'pdus'), (self.dsmx_Despreader_0, 'Msg')) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.digital_clock_recovery_mm_xx_1, 0)) self.connect((self.analog_quadrature_demod_cf_1, 0), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_1_1, 0)) self.connect((self.digital_binary_slicer_fb_1, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_1, 0), (self.digital_binary_slicer_fb_1, 0)) self.connect((self.digital_clock_recovery_mm_xx_1, 0), (self.qtgui_time_sink_x_1_1, 1)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.dsmx_preambleDetection_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.analog_quadrature_demod_cf_1, 0))
def __init__(self): gr.top_block.__init__(self, "Adsb Uhd") Qt.QWidget.__init__(self) self.setWindowTitle("Adsb Uhd") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "adsb_uhd") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.thresh_mult = thresh_mult = 2 self.samp_rate = samp_rate = 2e6 self.low_thresh = low_thresh = 0 self.rx_gain = rx_gain = 40 self.low_thresh_lbl = low_thresh_lbl = low_thresh self.high = high = .4 self.hi_thresh_lbl = hi_thresh_lbl = low_thresh * thresh_mult self.freq = freq = 1090e6 self.filter_taps = filter_taps = firdes.low_pass( 1, samp_rate, samp_rate / 2, 50000, firdes.WIN_FLATTOP, 6.76) self.decim = decim = 1 self.center = center = 0 self.bb_gain = bb_gain = .1e6 ################################################## # Message Queues ################################################## adsb_decoder_0_msgq_out = baz_message_server_0_msgq_in = gr.msg_queue( 2) adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue( 2) adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## self.probe_power = blocks.probe_signal_f() self._thresh_mult_tool_bar = Qt.QToolBar(self) self._thresh_mult_tool_bar.addWidget(Qt.QLabel("thresh_mult" + ": ")) self._thresh_mult_line_edit = Qt.QLineEdit(str(self.thresh_mult)) self._thresh_mult_tool_bar.addWidget(self._thresh_mult_line_edit) self._thresh_mult_line_edit.returnPressed.connect( lambda: self.set_thresh_mult( eng_notation.str_to_num( str(self._thresh_mult_line_edit.text().toAscii())))) self.top_layout.addWidget(self._thresh_mult_tool_bar) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel("rx_gain" + ": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect(lambda: self.set_rx_gain( eng_notation.str_to_num( str(self._rx_gain_line_edit.text().toAscii())))) self.top_layout.addWidget(self._rx_gain_tool_bar) def _low_thresh_probe(): while True: val = self.probe_power.level() try: self.set_low_thresh(val) except AttributeError: pass time.sleep(1.0 / (10)) _low_thresh_thread = threading.Thread(target=_low_thresh_probe) _low_thresh_thread.daemon = True _low_thresh_thread.start() self._center_tool_bar = Qt.QToolBar(self) self._center_tool_bar.addWidget(Qt.QLabel("center" + ": ")) self._center_line_edit = Qt.QLineEdit(str(self.center)) self._center_tool_bar.addWidget(self._center_line_edit) self._center_line_edit.returnPressed.connect(lambda: self.set_center( eng_notation.str_to_num( str(self._center_line_edit.text().toAscii())))) self.top_layout.addWidget(self._center_tool_bar) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel("bb_gain" + ": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect(lambda: self.set_bb_gain( eng_notation.str_to_num( str(self._bb_gain_line_edit.text().toAscii())))) self.top_layout.addWidget(self._bb_gain_tool_bar) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, samp_rate / 2), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.01) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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(-130, -70) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 4096, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.010) self.qtgui_time_sink_x_0.set_y_axis(0, 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_NORM, qtgui.TRIG_SLOPE_POS, .3, .0001, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) 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 = ['pre', 'post', '', '', '', '', '', '', '', ''] 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_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.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(-140, -80) 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(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self._low_thresh_lbl_tool_bar = Qt.QToolBar(self) if None: self._low_thresh_lbl_formatter = None else: self._low_thresh_lbl_formatter = lambda x: x self._low_thresh_lbl_tool_bar.addWidget( Qt.QLabel("low_thresh_lbl" + ": ")) self._low_thresh_lbl_label = Qt.QLabel( str(self._low_thresh_lbl_formatter(self.low_thresh_lbl))) self._low_thresh_lbl_tool_bar.addWidget(self._low_thresh_lbl_label) self.top_layout.addWidget(self._low_thresh_lbl_tool_bar) self._high_tool_bar = Qt.QToolBar(self) self._high_tool_bar.addWidget(Qt.QLabel("high" + ": ")) self._high_line_edit = Qt.QLineEdit(str(self.high)) self._high_tool_bar.addWidget(self._high_line_edit) self._high_line_edit.returnPressed.connect(lambda: self.set_high( eng_notation.str_to_num(str(self._high_line_edit.text().toAscii())) )) self.top_layout.addWidget(self._high_tool_bar) self._hi_thresh_lbl_tool_bar = Qt.QToolBar(self) if None: self._hi_thresh_lbl_formatter = None else: self._hi_thresh_lbl_formatter = lambda x: x self._hi_thresh_lbl_tool_bar.addWidget( Qt.QLabel("hi_thresh_lbl" + ": ")) self._hi_thresh_lbl_label = Qt.QLabel( str(self._hi_thresh_lbl_formatter(self.hi_thresh_lbl))) self._hi_thresh_lbl_tool_bar.addWidget(self._hi_thresh_lbl_label) self.top_layout.addWidget(self._hi_thresh_lbl_tool_bar) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (filter_taps), center, samp_rate) self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb( '1010000101000000', 0, 'adsb_preamble') self.blocks_threshold_ff_0 = blocks.threshold_ff( low_thresh, low_thresh * thresh_mult, 0) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (bb_gain, )) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 1000, .0001, 4000) self.blocks_message_source_0 = blocks.message_source( gr.sizeof_char * 1, blocks_message_source_0_msgq_in) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, '/dev/stdout', True) self.blocks_file_sink_0.set_unbuffered(True) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.baz_message_server_0 = message_server.message_server( msgq=baz_message_server_0_msgq_in, port=12345) self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out) self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in, tx_msgq=adsb_decoder_0_msgq_out, output_type="csv", check_parity=True) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.probe_power, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.adsb_framer_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Keyfob Decode Wav") ################################################## # Variables ################################################## self.sps = sps = 5 self.samp_rate = samp_rate = 48000 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400 * 5, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 3400.0*sps/48000, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.keyfob_parse_packet_0 = keyfob.parse_packet() self.keyfob_manchester_decode_0 = keyfob.manchester_decode() self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb("10101000", 0, "packet_start") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(5*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.05) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source("../gqrx_20150306_154200_434400000.wav", False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate*3,True) self.blocks_moving_average_xx_1 = blocks.moving_average_ff(sps, 1, 4000) ################################################## # Connections ################################################## self.connect((self.blocks_moving_average_xx_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.pfb_arb_resampler_xxx_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.keyfob_manchester_decode_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.wxgui_scopesink2_1, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.keyfob_parse_packet_0, 0)) self.connect((self.keyfob_manchester_decode_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_moving_average_xx_1, 0))
def __init__(self): gr.top_block.__init__(self, "Recepteur ADSB -Mode-S") Qt.QWidget.__init__(self) self.setWindowTitle("Recepteur ADSB -Mode-S") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "adsb_receiver") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.seuil = seuil = 0.003 self.samp_rate = samp_rate = 2000000 self.freq = freq = 1090000000 ################################################## # Blocks ################################################## self._seuil_range = Range(0.0001, 0.3, 0.0001, 0.003, 200) self._seuil_win = RangeWidget(self._seuil_range, self.set_seuil, 'Seuil', "counter_slider", float) self.top_grid_layout.addWidget(self._seuil_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._freq_range = Range(950000000, 1093000000, 10000, 1090000000, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.figures = Qt.QTabWidget() self.figures_widget_0 = Qt.QWidget() self.figures_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.figures_widget_0) self.figures_grid_layout_0 = Qt.QGridLayout() self.figures_layout_0.addLayout(self.figures_grid_layout_0) self.figures.addTab(self.figures_widget_0, 'Waterfall (recu)') self.figures_widget_1 = Qt.QWidget() self.figures_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.figures_widget_1) self.figures_grid_layout_1 = Qt.QGridLayout() self.figures_layout_1.addLayout(self.figures_grid_layout_1) self.figures.addTab(self.figures_widget_1, 'Spectre (recu)') self.figures_widget_2 = Qt.QWidget() self.figures_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.figures_widget_2) self.figures_grid_layout_2 = Qt.QGridLayout() self.figures_layout_2.addLayout(self.figures_grid_layout_2) self.figures.addTab(self.figures_widget_2, 'Rx: temporel / bits') self.top_grid_layout.addWidget(self.figures, 1, 0, 3, 2) for r in range(1, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.rtlsdr_source_0_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.rtlsdr_source_0_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.rtlsdr_source_0_0.set_sample_rate(samp_rate) self.rtlsdr_source_0_0.set_center_freq(freq, 0) self.rtlsdr_source_0_0.set_freq_corr(0, 0) self.rtlsdr_source_0_0.set_gain(14, 0) self.rtlsdr_source_0_0.set_if_gain(24, 0) self.rtlsdr_source_0_0.set_bb_gain(20, 0) self.rtlsdr_source_0_0.set_antenna('', 0) self.rtlsdr_source_0_0.set_bandwidth(samp_rate, 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "Spectre", #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) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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 range(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(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.figures_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0_2 = qtgui.time_sink_f( 250, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_2.set_update_time(0.10) self.qtgui_time_sink_x_0_2.set_y_axis(-0.1, 1.1) self.qtgui_time_sink_x_0_2.set_y_label('Manchester bits', "") self.qtgui_time_sink_x_0_2.enable_tags(True) self.qtgui_time_sink_x_0_2.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0.000008, 0, "burst") self.qtgui_time_sink_x_0_2.enable_autoscale(False) self.qtgui_time_sink_x_0_2.enable_grid(False) self.qtgui_time_sink_x_0_2.enable_axis_labels(True) self.qtgui_time_sink_x_0_2.enable_control_panel(True) self.qtgui_time_sink_x_0_2.enable_stem_plot(False) 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [8, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_2_win = sip.wrapinstance(self.qtgui_time_sink_x_0_2.pyqwidget(), Qt.QWidget) self.figures_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_2_win, 0, 1, 1, 1) for r in range(0, 1): self.figures_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.figures_grid_layout_2.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #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('Rx mag2', "") self.qtgui_time_sink_x_0_0.enable_tags(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(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(True) self.qtgui_time_sink_x_0_0.enable_stem_plot(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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): 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.figures_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0, 1, 1) for r in range(0, 1): self.figures_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.figures_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc samp_rate, #bw "", #name 1 ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 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(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) 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 range(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.figures_layout_1.addWidget(self._qtgui_freq_sink_x_0_win) self.digital_correlate_access_code_tag_xx_0 = digital.correlate_access_code_tag_bb('010100001010000001001010110', 0, 'burst') self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_threshold_ff_0 = blocks.threshold_ff(seuil, seuil, 0) self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink(gr.sizeof_char*1, samp_rate) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_burst_tagger_0 = blocks.burst_tagger(gr.sizeof_char) self.blocks_burst_tagger_0.set_true_tag('',True) self.blocks_burst_tagger_0.set_false_tag('burst',False) self.analog_sig_source_x_1 = analog.sig_source_s(samp_rate, analog.GR_COS_WAVE, 80, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_1, 0), (self.blocks_burst_tagger_0, 1)) self.connect((self.blocks_burst_tagger_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_burst_tagger_0, 0), (self.blocks_tagged_file_sink_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.digital_correlate_access_code_tag_xx_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0_2, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.blocks_burst_tagger_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.rtlsdr_source_0_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.rtlsdr_source_0_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rtlsdr_source_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self, meta_rate=10): gr.top_block.__init__(self, "Fox1D Decode Hs") Qt.QWidget.__init__(self) self.setWindowTitle("Fox1D Decode Hs") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "fox1d_decode_hs") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.meta_rate = meta_rate ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 self.decim = decim = 5 self.baud = baud = 9600 self.xlate_taps = xlate_taps = firdes.low_pass(1.0, samp_rate, samp_rate / 2, 1000, firdes.WIN_HAMMING, 6.76) self.throttle_factor = throttle_factor = 1 self.samps_per_symb_2 = samps_per_symb_2 = (samp_rate / decim) / 25 * 24 / baud self.samps_per_symb_1 = samps_per_symb_1 = samp_rate / decim / baud self.fsk_deviation_hz = fsk_deviation_hz = 4000 ################################################## # Blocks ################################################## self._throttle_factor_tool_bar = Qt.QToolBar(self) self._throttle_factor_tool_bar.addWidget( Qt.QLabel("throttle_factor" + ": ")) self._throttle_factor_line_edit = Qt.QLineEdit( str(self.throttle_factor)) self._throttle_factor_tool_bar.addWidget( self._throttle_factor_line_edit) self._throttle_factor_line_edit.returnPressed.connect( lambda: self.set_throttle_factor( eng_notation.str_to_num( str(self._throttle_factor_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._throttle_factor_tool_bar, 6, 0, 1, 2) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=48, decimation=50, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "corrected", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0_0.enable_grid(False) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-80, 0) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 3, 3, 3, 3) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "Pre-D", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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(-80, 0) 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, 3, 3, 3) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024 / 4, #size samp_rate / decim / 25 * 24 / baud, #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(-0.5, 1.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(False) 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.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( samp_rate / decim / 24 * 25 / baud, 100, 300, ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win) self.qtgui_number_sink_0_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0_0_0_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0_0_0_0.set_title("") labels = ['SNR', '', '', '', '', '', '', '', '', ''] units = ['dB', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_0_0_0.set_min(i, 0) self.qtgui_number_sink_0_0_0_0_0.set_max(i, 30) self.qtgui_number_sink_0_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0_0.set_label( i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_0_win, 6, 4, 1, 2) self.qtgui_number_sink_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0_0_0_0.set_update_time(0.010) self.qtgui_number_sink_0_0_0_0.set_title("") labels = ['Freq Offset', 'Phase', 'Error', '', '', '', '', '', '', ''] units = ['Hz', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_0_0.set_min(i, -32767) self.qtgui_number_sink_0_0_0_0.set_max(i, 32767) self.qtgui_number_sink_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0.set_label( i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_win, 6, 2, 1, 2) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "corrected", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_0_0.set_y_axis(-80, 0) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3, 0, 3, 3) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "Pre-D", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-80, 0) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 3, 3) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024 / 4, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_const_sink_x_0_win) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate / decim, 10e3, 2e3, firdes.WIN_HAMMING, 6.76)) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( decim, (xlate_taps), 0, samp_rate) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( samps_per_symb_1, .5, 1024, math.pi / 500) self.digital_correlate_access_code_tag_xx_0 = digital.correlate_access_code_tag_bb( '101011001000111', 0, 'syncword') self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samps_per_symb_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_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * throttle_factor, True) self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu( blocks.float_t, 'snr') self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.float_t, 'rfo') self.blocks_stream_to_tagged_stream_0_0 = blocks.stream_to_tagged_stream( gr.sizeof_float, 1, 1, "snr") self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_float, 1, 1, "rfo") self.blocks_socket_pdu_0_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52002', 10000, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52001', 10000, False) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_nlog10_ff_0_1 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (-1 * samp_rate / decim / (2 * math.pi), )) self.blocks_moving_average_xx_0_0_1 = blocks.moving_average_ff( 10000, 0.0001, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 100000, 0.00001, 4000, 1) self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_float * 1, int(samp_rate * meta_rate)) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_float * 1, int(samp_rate / 4 * meta_rate)) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/zleffke/captures/fox1d/FOX-1D_USRP_20180113_161106.862011_UTC_250k.fc32', False) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, samp_rate / 2, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0, 'pdus'), (self.blocks_socket_pdu_0_0, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_stream_to_tagged_stream_0_0, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_number_sink_0_0_0_0, 0)) self.connect((self.blocks_moving_average_xx_0_0_1, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_moving_average_xx_0_0_1, 0), (self.qtgui_number_sink_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_nlog10_ff_0_1, 0), (self.blocks_moving_average_xx_0_0_1, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_tag_xx_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 3), (self.blocks_null_sink_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_squared_0_0, 0))
def __init__(self, meta_rate=1): gr.top_block.__init__(self, "Lms6 Experiment") Qt.QWidget.__init__(self) self.setWindowTitle("Lms6 Experiment") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "lms6_experiment") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.meta_rate = meta_rate ################################################## # Variables ################################################## self.samp_rate = samp_rate = 50e3 self.decim = decim = 1 self.baud = baud = 4800 self.xlate_taps = xlate_taps = firdes.low_pass(1.0, samp_rate, samp_rate / 2, 1000, firdes.WIN_HAMMING, 6.76) self.variable_tag_object_0 = variable_tag_object_0 = gr.tag_utils.python_to_tag( (0, pmt.intern("key"), pmt.intern("value"), pmt.intern("src"))) self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y%m%d_%H%M%S.%f") + '_UTC' self.sync3 = sync3 = "001110110010000000000000000000000000000000000000" self.sync2 = sync2 = "00111011001000000000000000000000" self.samps_per_symb = samps_per_symb = samp_rate / decim * 24 / 25 / baud self.offset = offset = 0 ################################################## # Blocks ################################################## self._offset_tool_bar = Qt.QToolBar(self) self._offset_tool_bar.addWidget(Qt.QLabel('OFFSET' + ": ")) self._offset_line_edit = Qt.QLineEdit(str(self.offset)) self._offset_tool_bar.addWidget(self._offset_line_edit) self._offset_line_edit.returnPressed.connect(lambda: self.set_offset( eng_notation.str_to_num( str(self._offset_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._offset_tool_bar, 3, 3, 1, 3) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=24, decimation=25, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024 * 4, #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, 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, "hit") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(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 = [0, -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.qtgui_number_sink_0_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0_0_0_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0_0_0_0.set_title("") labels = ['SNR', '', '', '', '', '', '', '', '', ''] units = ['dB', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_0_0_0.set_min(i, 0) self.qtgui_number_sink_0_0_0_0_0.set_max(i, 30) self.qtgui_number_sink_0_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0_0.set_label( i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_0_win, 4, 4, 1, 1) self.qtgui_number_sink_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0_0_0_0.set_update_time(0.010) self.qtgui_number_sink_0_0_0_0.set_title("") labels = ['Freq Offset', 'Phase', 'Error', '', '', '', '', '', '', ''] units = ['Hz', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_0_0.set_min(i, -32767) self.qtgui_number_sink_0_0_0_0.set_max(i, 32767) self.qtgui_number_sink_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0.set_label( i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_win, 4, 3, 1, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "Filtered", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_0_0.set_y_axis(-70, -10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 0, 3, 3, 3) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "Freq compensated", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-70, -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.05) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 3, 3) self.low_pass_filter_0 = filter.fir_filter_ccf( decim, firdes.low_pass(1, samp_rate, 7.5e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.kiss_nrzi_decode_0 = kiss.nrzi_decode() self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (xlate_taps), offset, samp_rate) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( samps_per_symb, .5, 1024, math.pi / 500) self.digital_correlate_access_code_tag_xx_0 = digital.correlate_access_code_tag_bb( sync3, 0, 'hit') self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samps_per_symb * (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_tagged_stream_to_pdu_1 = blocks.tagged_stream_to_pdu( blocks.byte_t, 'packet_len') self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu( blocks.float_t, 'snr') self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu( blocks.float_t, 'rfo') self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length( gr.sizeof_char * 1, 'packet_len', 1 / 8.0) self.blocks_tagged_stream_align_0 = blocks.tagged_stream_align( gr.sizeof_char * 1, 'hit') self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1, '', "") self.blocks_tag_debug_0.set_display(True) self.blocks_stream_to_tagged_stream_1 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, 576, "packet_len") self.blocks_stream_to_tagged_stream_0_0 = blocks.stream_to_tagged_stream( gr.sizeof_float, 1, 1, "snr") self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_float, 1, 1, "rfo") self.blocks_socket_pdu_0_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52002', 10000, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '52001', 10000, False) self.blocks_pdu_filter_0 = blocks.pdu_filter(pmt.intern("hit"), pmt.from_long(0), False) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_nlog10_ff_0_1 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (-1 * samp_rate / (2 * math.pi), )) self.blocks_moving_average_xx_0_0_1 = blocks.moving_average_ff( 10000, 0.0001, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 10000, 0.0001, 4000, 1) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_float * 1, int(samp_rate * meta_rate)) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_float * 1, int(samp_rate / 4 * meta_rate)) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/zleffke/captures/radiosonde/BBNWS_LMS6_RTLSDR_20171202_235806.395054_UTC_50k.fc32', False) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.audio_sink_1 = audio.sink(48000, '', True) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, samp_rate / 2, 1, 0) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=int(samp_rate / decim * 24 / 25), quad_rate=int(samp_rate / decim * 24 / 25), tau=75e-6, max_dev=5e3, ) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_pdu_filter_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0, 'pdus'), (self.blocks_socket_pdu_0_0, 'pdus')) self.msg_connect((self.blocks_tagged_stream_to_pdu_1, 'pdus'), (self.blocks_pdu_filter_0, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.audio_sink_1, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_stream_to_tagged_stream_0_0, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_number_sink_0_0_0_0, 0)) self.connect((self.blocks_moving_average_xx_0_0_1, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_moving_average_xx_0_0_1, 0), (self.qtgui_number_sink_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_nlog10_ff_0_1, 0), (self.blocks_moving_average_xx_0_0_1, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_1, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.blocks_tagged_stream_align_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_tagged_stream_align_0, 0), (self.blocks_stream_to_tagged_stream_1, 0)) self.connect((self.blocks_tagged_stream_align_0, 0), (self.blocks_tag_debug_0, 0)) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_1, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.kiss_nrzi_decode_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_correlate_access_code_tag_xx_0, 0), (self.blocks_tagged_stream_align_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 3), (self.blocks_null_sink_0_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_fll_band_edge_cc_0, 0)) self.connect((self.kiss_nrzi_decode_0, 0), (self.digital_correlate_access_code_tag_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_squared_0_0, 0))