def __init__(self, timeslot, burst_file, mode, show_gprs): gr.top_block.__init__(self, "Top Block") self.gsm_burst_file_source = grgsm.burst_file_source(burst_file) self.gsm_burst_timeslot_filter = grgsm.burst_timeslot_filter(timeslot) if mode == 'BCCH_SDCCH4': self.demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper( timeslot_nr=timeslot, ) else: self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.gsm_control_channels_decoder = grgsm.control_channels_decoder() self.gsm_extract_cmc = grgsm.extract_cmc() self.gsm_extract_immediate_assignment = grgsm.extract_immediate_assignment( False, not show_gprs, True) self.gsm_extract_system_info = grgsm.extract_system_info() self.msg_connect((self.gsm_burst_file_source, 'out'), (self.gsm_burst_timeslot_filter, 'in')) self.msg_connect((self.gsm_burst_timeslot_filter, 'out'), (self.demapper, 'bursts')) self.msg_connect((self.demapper, 'bursts'), (self.gsm_control_channels_decoder, 'bursts')) self.msg_connect((self.gsm_control_channels_decoder, 'msgs'), (self.gsm_extract_cmc, 'msgs')) self.msg_connect((self.gsm_control_channels_decoder, 'msgs'), (self.gsm_extract_immediate_assignment, 'msgs')) self.msg_connect((self.gsm_control_channels_decoder, 'msgs'), (self.gsm_extract_system_info, 'msgs'))
def __init__(self, source, destination, framenr_ge=None, framenr_le=None, timeslot=None, subslot=None, filter_dummy_bursts=False): gr.top_block.__init__(self, "Top Block") self.burst_file_source = grgsm.burst_file_source(source) self.burst_file_sink = grgsm.burst_file_sink(destination) lastblock = self.burst_file_source if framenr_ge is not None: self.burst_fnr_filterge = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, framenr_ge) self.msg_connect((lastblock, 'out'), (self.burst_fnr_filterge, 'in')) lastblock = self.burst_fnr_filterge if framenr_le is not None: self.burst_fnr_filterle = grgsm.burst_fnr_filter(grgsm.FILTER_LESS_OR_EQUAL, framenr_le) self.msg_connect((lastblock, 'out'), (self.burst_fnr_filterle, 'in')) lastblock = self.burst_fnr_filterle if timeslot is not None: self.burst_timeslot_filter = grgsm.burst_timeslot_filter(timeslot) self.msg_connect((lastblock, 'out'), (self.burst_timeslot_filter, 'in')) lastblock = self.burst_timeslot_filter if subslot is not None: self.burst_sdcch_subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, subslot) self.msg_connect((lastblock, 'out'), (self.burst_sdcch_subslot_filter, 'in')) lastblock = self.burst_sdcch_subslot_filter if filter_dummy_bursts: self.dummy_burst_filter = grgsm.dummy_burst_filter() self.msg_connect((lastblock, 'out'), (self.dummy_burst_filter, 'in')) lastblock = self.dummy_burst_filter self.msg_connect((lastblock, 'out'), (self.burst_file_sink, 'in'))
def __init__(self, burst_file, timeslot, mode, framenumber): gr.top_block.__init__(self, "Top Block") self.burst_file_source = grgsm.burst_file_source(burst_file) self.timeslot_filter = grgsm.burst_timeslot_filter(timeslot) self.fnr_filter_start = grgsm.burst_fnr_filter( grgsm.FILTER_GREATER_OR_EQUAL, framenumber) if mode == 'BCCH_SDCCH4': self.demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper( timeslot_nr=timeslot, ) else: self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.decoder = grgsm.control_channels_decoder() self.extract_immediate_assignment = grgsm.extract_immediate_assignment( ) self.msg_connect((self.burst_file_source, 'out'), (self.timeslot_filter, 'in')) self.msg_connect((self.timeslot_filter, 'out'), (self.fnr_filter_start, 'in')) self.msg_connect((self.fnr_filter_start, 'out'), (self.demapper, 'bursts')) self.msg_connect((self.demapper, 'bursts'), (self.decoder, 'bursts')) self.msg_connect((self.decoder, 'msgs'), (self.extract_immediate_assignment, 'msgs'))
def __init__(self, timeslot, burst_file, mode, fnr_start, fnr_end): gr.top_block.__init__(self, "Top Block") self.burst_file_source = grgsm.burst_file_source(burst_file) self.timeslot_filter = grgsm.burst_timeslot_filter(timeslot) self.fnr_filter_start = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, fnr_start) self.fnr_filter_end = grgsm.burst_fnr_filter(grgsm.FILTER_LESS_OR_EQUAL, fnr_end) if mode == 'BCCH_SDCCH4': self.subslot_splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH4) self.subslot_analyzers = [CMCAnalyzerArm() for x in range(4)] self.demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=timeslot, ) else: self.subslot_splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH8) self.subslot_analyzers = [CMCAnalyzerArm() for x in range(8)] self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.control_channels_decoder = grgsm.control_channels_decoder() self.burst_sink = grgsm.burst_sink() self.msg_connect((self.burst_file_source, 'out'), (self.timeslot_filter, 'in')) self.msg_connect((self.timeslot_filter, 'out'), (self.fnr_filter_start, 'in')) self.msg_connect((self.fnr_filter_start, 'out'), (self.fnr_filter_end, 'in')) self.msg_connect((self.fnr_filter_end, 'out'), (self.demapper, 'bursts')) self.msg_connect((self.demapper, 'bursts'), (self.burst_sink, 'in')) self.msg_connect((self.demapper, 'bursts'), (self.subslot_splitter, 'in')) for i in range(4 if mode == 'BCCH_SDCCH4' else 8): self.msg_connect((self.subslot_splitter, 'out' + str(i)), (self.subslot_analyzers[i], 'in')) self.bursts = None self.cmcs = None
def __init__(self, burst_file, timeslot, subchannel, mode, fnr_start): gr.top_block.__init__(self, "Top Block") self.burst_file_source = grgsm.burst_file_source(burst_file) self.timeslot_filter = grgsm.burst_timeslot_filter(timeslot) self.fnr_filter_start = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, fnr_start) # we only listen for a timespan of 12 SDCCH messages for the CMC self.fnr_filter_end = grgsm.burst_fnr_filter(grgsm.FILTER_LESS_OR_EQUAL, fnr_start + 51 * 10000) if mode == "BCCH_SDCCH4": self.subchannel_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4, subchannel) self.demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=timeslot, ) else: self.subchannel_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, subchannel) self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.decoder = grgsm.control_channels_decoder() self.extract_cmc = grgsm.extract_cmc() self.msg_connect((self.burst_file_source, 'out'), (self.timeslot_filter, 'in')) self.msg_connect((self.timeslot_filter, 'out'), (self.subchannel_filter, 'in')) self.msg_connect((self.subchannel_filter, 'out'), (self.fnr_filter_start, 'in')) self.msg_connect((self.fnr_filter_start, 'out'), (self.fnr_filter_end, 'in')) self.msg_connect((self.fnr_filter_end, 'out'), (self.demapper, 'bursts')) self.msg_connect((self.demapper, 'bursts'), (self.decoder, 'bursts')) self.msg_connect((self.decoder, 'msgs'), (self.extract_cmc, 'msgs'))
def __init__(self, timeslot, burst_file, mode): gr.top_block.__init__(self, "Top Block") self.si_messages = dict() self.burst_file_source = grgsm.burst_file_source(burst_file) self.timeslot_filter = grgsm.burst_timeslot_filter(timeslot) if mode == 'BCCH_SDCCH4': self.demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=timeslot, ) else: self.demapper = grgsm.gsm_sdcch8_demapper(timeslot_nr=timeslot, ) self.decoder = grgsm.control_channels_decoder() self.control_channels_decoder = grgsm.control_channels_decoder() self.collect_system_info = grgsm.collect_system_info() self.msg_connect((self.burst_file_source, 'out'), (self.timeslot_filter, 'in')) self.msg_connect((self.timeslot_filter, 'out'), (self.demapper, 'bursts')) self.msg_connect((self.demapper, 'bursts'), (self.decoder, 'bursts')) self.msg_connect((self.decoder, 'msgs'), (self.collect_system_info, 'msgs'))
def __init__(self, fc=943.6e6, shiftoff=400e3, ppm=0, gain=30, samp_rate=2000000.052982): gr.top_block.__init__(self, "Decode Bursts Nogui") ################################################## # Parameters ################################################## self.fc = fc self.shiftoff = shiftoff self.ppm = ppm self.gain = gain self.samp_rate = samp_rate ################################################## # Blocks ################################################## self.gsm_sdcch8_demapper_0 = grgsm.universal_ctrl_chans_demapper(1, ([0,4,8,12,16,20,24,28,32,36,40,44]), ([8,8,8,8,8,8,8,8,136,136,136,136])) self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False, False, False) self.gsm_decryption_0 = grgsm.decryption(([]), 1) self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder() self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_burst_file_source_0 = grgsm.burst_file_source("/tmp/bursts") self.gsm_bcch_ccch_demapper_0 = grgsm.universal_ctrl_chans_demapper(0, ([2,6,12,16,22,26,32,36,42,46]), ([1,2,2,2,2,2,2,2,2,2])) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.gsm_sdcch8_demapper_0, "bursts", self.gsm_decryption_0, "bursts") self.msg_connect(self.gsm_decryption_0, "bursts", self.gsm_control_channels_decoder_0_0, "bursts") self.msg_connect(self.gsm_control_channels_decoder_0_0, "msgs", self.gsm_message_printer_1, "msgs") self.msg_connect(self.gsm_control_channels_decoder_0_0, "msgs", self.blocks_socket_pdu_0, "pdus") self.msg_connect(self.gsm_control_channels_decoder_0, "msgs", self.gsm_message_printer_1, "msgs") self.msg_connect(self.gsm_control_channels_decoder_0, "msgs", self.blocks_socket_pdu_0, "pdus") self.msg_connect(self.gsm_bcch_ccch_demapper_0, "bursts", self.gsm_control_channels_decoder_0, "bursts") self.msg_connect(self.gsm_burst_file_source_0, "out", self.gsm_bcch_ccch_demapper_0, "bursts") self.msg_connect(self.gsm_burst_file_source_0, "out", self.gsm_sdcch8_demapper_0, "bursts")
def __init__(self, timeslot=0, chan_mode='BCCH', burst_file=None, cfile=None, fc=None, samp_rate=2e6, ppm=0): gr.top_block.__init__(self, "gr-gsm TMSI Capture") ################################################## # Parameters ################################################## self.timeslot = timeslot self.chan_mode = chan_mode self.burst_file = burst_file self.cfile = cfile self.fc = fc self.samp_rate = samp_rate self.ppm = ppm ################################################## # Blocks ################################################## if self.burst_file: self.burst_file_source = grgsm.burst_file_source(burst_file) elif self.cfile: self.file_source = blocks.file_source(gr.sizeof_gr_complex * 1, self.cfile, False) self.receiver = grgsm.receiver(4, ([0]), ([])) if self.fc is not None: self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, fc=self.fc, samp_rate_in=samp_rate) self.offset_control = grgsm.clock_offset_control( self.fc, self.samp_rate) else: self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, samp_rate_in=samp_rate) self.dummy_burst_filter = grgsm.dummy_burst_filter() self.timeslot_filter = grgsm.burst_timeslot_filter(self.timeslot) if self.chan_mode == 'BCCH': self.bcch_demapper = grgsm.gsm_bcch_ccch_demapper(self.timeslot) elif self.chan_mode == 'BCCH_SDCCH4': self.bcch_sdcch4_demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper( self.timeslot) self.cch_decoder = grgsm.control_channels_decoder() self.tmsi_dumper = grgsm.tmsi_dumper() self.socket_pdu_server = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000) self.socket_pdu = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000) ################################################## # Asynch Message Connections ################################################## if self.burst_file: self.msg_connect(self.burst_file_source, "out", self.dummy_burst_filter, "in") elif self.cfile: self.connect((self.file_source, 0), (self.input_adapter, 0)) self.connect((self.input_adapter, 0), (self.receiver, 0)) if self.fc is not None: self.msg_connect(self.offset_control, "ctrl", self.input_adapter, "ctrl_in") self.msg_connect(self.receiver, "measurements", self.offset_control, "measurements") self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in") self.msg_connect(self.dummy_burst_filter, "out", self.timeslot_filter, "in") if self.chan_mode == 'BCCH': self.msg_connect(self.timeslot_filter, "out", self.bcch_demapper, "bursts") self.msg_connect(self.bcch_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.cch_decoder, "msgs", self.tmsi_dumper, "msgs") elif self.chan_mode == 'BCCH_SDCCH4': self.msg_connect(self.timeslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.cch_decoder, "msgs", self.tmsi_dumper, "msgs")
def __init__(self, timeslot=0, subslot=None, chan_mode='BCCH', burst_file=None, cfile=None, fc=939.4e6, samp_rate=2e6, arfcn=None, a5=1, a5_kc=None, speech_file=None, speech_codec=None): gr.top_block.__init__(self, "Airprobe Decode") ################################################## # Parameters ################################################## self.timeslot = timeslot self.subslot = subslot self.chan_mode = chan_mode self.burst_file = burst_file self.cfile = cfile self.fc = fc self.samp_rate = samp_rate self.arfcn = arfcn self.a5 = a5 self.kc = a5_kc if len(a5_kc) < 8: self.kc = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] self.speech_file = speech_file self.speech_codec = speech_codec ################################################## # Blocks ################################################## if self.burst_file: self.burst_file_source = grgsm.burst_file_source(burst_file) elif self.cfile: self.file_source = blocks.file_source(gr.sizeof_gr_complex*1, self.cfile, False) self.receiver = grgsm.receiver(4, ([0]), ([])) self.input_adapter = grgsm.gsm_input( ppm=0, osr=4, fc=fc, samp_rate_in=samp_rate, ) self.offset_control = grgsm.clock_offset_control(fc) self.dummy_burst_filter = grgsm.dummy_burst_filter() self.timeslot_filter = grgsm.burst_timeslot_filter(self.timeslot) self.subslot_filter = None if self.chan_mode == 'BCCH_SDCCH4' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4, self.subslot) elif self.chan_mode == 'SDCCH8' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, self.subslot) if self.chan_mode == 'BCCH': self.bcch_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), ([1, 2, 2, 2, 2, 2, 2, 2, 2, 2])) elif self.chan_mode == 'BCCH_SDCCH4': self.bcch_sdcch4_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), ([1, 2, 2, 2, 7, 7, 7, 7, 135, 135])) elif self.chan_mode == 'SDCCH8': self.sdcch8_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, ([0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44]), ([8, 8, 8, 8, 8, 8, 8, 8, 136, 136, 136, 136])) elif self.chan_mode == 'TCHF': self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot) self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, speech_file) if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.decryption = grgsm.decryption(self.kc, self.a5) self.cch_decoder_decrypted = grgsm.control_channels_decoder() if self.chan_mode == 'TCHF': self.decryption_tch_sacch = grgsm.decryption(self.kc, self.a5) self.cch_decoder = grgsm.control_channels_decoder() self.socket_pdu = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False) ################################################## # Asynch Message Connections ################################################## if self.burst_file: self.msg_connect(self.burst_file_source, "out", self.dummy_burst_filter, "in") elif self.cfile: self.connect((self.file_source, 0), (self.input_adapter, 0)) self.connect((self.input_adapter, 0), (self.receiver, 0)) self.msg_connect(self.offset_control, "ppm", self.input_adapter, "ppm_in") self.msg_connect(self.receiver, "measurements", self.offset_control, "measurements") self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in") self.msg_connect(self.dummy_burst_filter, "out", self.timeslot_filter, "in") if (self.chan_mode == 'BCCH_SDCCH4' or self.chan_mode == 'SDCCH8') and self.subslot_filter is not None: self.msg_connect(self.timeslot_filter, "out", self.subslot_filter, "in") if self.chan_mode == 'BCCH': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_demapper, "bursts") self.msg_connect(self.bcch_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") elif self.chan_mode == 'BCCH_SDCCH4': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") elif self.chan_mode == 'SDCCH8': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.sdcch8_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.sdcch8_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.sdcch8_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.sdcch8_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") elif self.chan_mode == 'TCHF': self.msg_connect(self.timeslot_filter, "out", self.tch_f_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.decryption_tch_sacch, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.decryption, "bursts") self.msg_connect(self.decryption_tch_sacch, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.decryption, "bursts", self.tch_f_decoder, "bursts") else: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.cch_decoder, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.tch_f_decoder, "bursts") self.msg_connect(self.tch_f_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus")
def __init__(self, timeslot=0, subslot=None, chan_mode='BCCH', burst_file=None, cfile=None, fc=939.4e6, samp_rate=2e6, arfcn=None, a5=1, a5_kc=None, speech_file=None, speech_codec=None, verbose=False): gr.top_block.__init__(self, "Airprobe Decode") ################################################## # Parameters ################################################## self.timeslot = timeslot self.subslot = subslot self.chan_mode = chan_mode self.burst_file = burst_file self.cfile = cfile self.fc = fc self.samp_rate = samp_rate self.arfcn = arfcn self.a5 = a5 self.kc = a5_kc if len(a5_kc) < 8: self.kc = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] self.speech_file = speech_file self.speech_codec = speech_codec self.verbose = verbose ################################################## # Blocks ################################################## if self.burst_file: self.burst_file_source = grgsm.burst_file_source(burst_file) elif self.cfile: self.file_source = blocks.file_source(gr.sizeof_gr_complex * 1, self.cfile, False) self.receiver = grgsm.receiver(4, ([0]), ([])) self.input_adapter = grgsm.gsm_input( ppm=0, osr=4, fc=fc, samp_rate_in=samp_rate, ) self.offset_control = grgsm.clock_offset_control(fc) self.dummy_burst_filter = grgsm.dummy_burst_filter() self.timeslot_filter = grgsm.burst_timeslot_filter(self.timeslot) self.subslot_filter = None if self.chan_mode == 'BCCH_SDCCH4' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter( grgsm.SS_FILTER_SDCCH4, self.subslot) elif self.chan_mode == 'SDCCH8' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter( grgsm.SS_FILTER_SDCCH8, self.subslot) if self.chan_mode == 'BCCH': self.bcch_demapper = grgsm.universal_ctrl_chans_demapper( self.timeslot, ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), ([1, 2, 2, 2, 2, 2, 2, 2, 2, 2])) elif self.chan_mode == 'BCCH_SDCCH4': self.bcch_sdcch4_demapper = grgsm.universal_ctrl_chans_demapper( self.timeslot, ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), ([1, 2, 2, 2, 7, 7, 7, 7, 135, 135])) elif self.chan_mode == 'SDCCH8': self.sdcch8_demapper = grgsm.universal_ctrl_chans_demapper( self.timeslot, ([0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44]), ([8, 8, 8, 8, 8, 8, 8, 8, 136, 136, 136, 136])) elif self.chan_mode == 'TCHF': self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot) self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, speech_file) if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.decryption = grgsm.decryption(self.kc, self.a5) self.cch_decoder_decrypted = grgsm.control_channels_decoder() if self.chan_mode == 'TCHF': self.decryption_tch_sacch = grgsm.decryption(self.kc, self.a5) self.cch_decoder = grgsm.control_channels_decoder() self.socket_pdu = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False) if self.verbose: self.message_printer = grgsm.message_printer( pmt.intern(""), True, True, False) ################################################## # Asynch Message Connections ################################################## if self.burst_file: self.msg_connect(self.burst_file_source, "out", self.dummy_burst_filter, "in") elif self.cfile: self.connect((self.file_source, 0), (self.input_adapter, 0)) self.connect((self.input_adapter, 0), (self.receiver, 0)) self.msg_connect(self.offset_control, "ppm", self.input_adapter, "ppm_in") self.msg_connect(self.receiver, "measurements", self.offset_control, "measurements") self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in") self.msg_connect(self.dummy_burst_filter, "out", self.timeslot_filter, "in") if (self.chan_mode == 'BCCH_SDCCH4' or self.chan_mode == 'SDCCH8') and self.subslot_filter is not None: self.msg_connect(self.timeslot_filter, "out", self.subslot_filter, "in") if self.chan_mode == 'BCCH': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_demapper, "bursts") self.msg_connect(self.bcch_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'BCCH_SDCCH4': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder_decrypted, "msgs", self.message_printer, "msgs") self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'SDCCH8': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.sdcch8_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.sdcch8_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.sdcch8_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder_decrypted, "msgs", self.message_printer, "msgs") self.msg_connect(self.sdcch8_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'TCHF': self.msg_connect(self.timeslot_filter, "out", self.tch_f_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.decryption_tch_sacch, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.decryption, "bursts") self.msg_connect(self.decryption_tch_sacch, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.decryption, "bursts", self.tch_f_decoder, "bursts") else: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.cch_decoder, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.tch_f_decoder, "bursts") self.msg_connect(self.tch_f_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.tch_f_decoder, "msgs", self.message_printer, "msgs") self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs")
def __init__(self, gain=30, ppm=0, samp_rate=2000000.052982, shiftoff=400e3, fc=943.6e6): gr.top_block.__init__(self, "Decode Bursts") Qt.QWidget.__init__(self) self.setWindowTitle("Decode Bursts") 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", "decode_bursts") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.gain = gain self.ppm = ppm self.samp_rate = samp_rate self.shiftoff = shiftoff self.fc = fc ################################################## # Variables ################################################## self.ppm_slider = ppm_slider = ppm self.g_slider = g_slider = gain self.fc_slider = fc_slider = fc ################################################## # Blocks ################################################## self._ppm_slider_layout = Qt.QHBoxLayout() self._ppm_slider_layout.addWidget(Qt.QLabel("PPM Offset"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._ppm_slider_counter = qwt_counter_pyslot() self._ppm_slider_counter.setRange(-150, 150, 1) self._ppm_slider_counter.setNumButtons(2) self._ppm_slider_counter.setMinimumWidth(100) self._ppm_slider_counter.setValue(self.ppm_slider) self._ppm_slider_layout.addWidget(self._ppm_slider_counter) self._ppm_slider_counter.valueChanged.connect(self.set_ppm_slider) self.top_layout.addLayout(self._ppm_slider_layout) self.gsm_sdcch8_demapper_0 = grgsm.universal_ctrl_chans_demapper(1, ([0,4,8,12,16,20,24,28,32,36,40,44]), ([8,8,8,8,8,8,8,8,136,136,136,136])) self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False, False, False) self.gsm_decryption_0 = grgsm.decryption(([]), 1) self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder() self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_burst_file_source_0 = grgsm.burst_file_source("/tmp/bursts") self.gsm_bcch_ccch_demapper_0 = grgsm.universal_ctrl_chans_demapper(0, ([2,6,12,16,22,26,32,36,42,46]), ([1,2,2,2,2,2,2,2,2,2])) self._g_slider_layout = Qt.QHBoxLayout() self._g_slider_layout.addWidget(Qt.QLabel("Gain"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._g_slider_counter = qwt_counter_pyslot() self._g_slider_counter.setRange(0, 50, 0.5) self._g_slider_counter.setNumButtons(2) self._g_slider_counter.setMinimumWidth(100) self._g_slider_counter.setValue(self.g_slider) self._g_slider_layout.addWidget(self._g_slider_counter) self._g_slider_counter.valueChanged.connect(self.set_g_slider) self.top_layout.addLayout(self._g_slider_layout) self._fc_slider_layout = Qt.QVBoxLayout() self._fc_slider_tool_bar = Qt.QToolBar(self) self._fc_slider_layout.addWidget(self._fc_slider_tool_bar) self._fc_slider_tool_bar.addWidget(Qt.QLabel("Frequency"+": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._fc_slider_counter = qwt_counter_pyslot() self._fc_slider_counter.setRange(925e6, 1990e6, 2e5) self._fc_slider_counter.setNumButtons(2) self._fc_slider_counter.setValue(self.fc_slider) self._fc_slider_tool_bar.addWidget(self._fc_slider_counter) self._fc_slider_counter.valueChanged.connect(self.set_fc_slider) self._fc_slider_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._fc_slider_slider.setRange(925e6, 1990e6, 2e5) self._fc_slider_slider.setValue(self.fc_slider) self._fc_slider_slider.setMinimumWidth(100) self._fc_slider_slider.valueChanged.connect(self.set_fc_slider) self._fc_slider_layout.addWidget(self._fc_slider_slider) self.top_layout.addLayout(self._fc_slider_layout) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False) ################################################## # Asynch Message Connections ################################################## self.msg_connect(self.gsm_burst_file_source_0, "out", self.gsm_sdcch8_demapper_0, "bursts") self.msg_connect(self.gsm_burst_file_source_0, "out", self.gsm_bcch_ccch_demapper_0, "bursts") self.msg_connect(self.gsm_bcch_ccch_demapper_0, "bursts", self.gsm_control_channels_decoder_0, "bursts") self.msg_connect(self.gsm_control_channels_decoder_0, "msgs", self.blocks_socket_pdu_0, "pdus") self.msg_connect(self.gsm_control_channels_decoder_0, "msgs", self.gsm_message_printer_1, "msgs") self.msg_connect(self.gsm_control_channels_decoder_0_0, "msgs", self.blocks_socket_pdu_0, "pdus") self.msg_connect(self.gsm_control_channels_decoder_0_0, "msgs", self.gsm_message_printer_1, "msgs") self.msg_connect(self.gsm_decryption_0, "bursts", self.gsm_control_channels_decoder_0_0, "bursts") self.msg_connect(self.gsm_sdcch8_demapper_0, "bursts", self.gsm_decryption_0, "bursts")