Пример #1
0
    def __init__(self, instance_uuid):
        self.log = logging.getLogger('overseer.call_recorder')
        self.log.info('Initializing call_recorder')
        self.log.info('%s call recorder startup pid %s' %
                      (instance_uuid, os.getpid()))
        self.instance_uuid = instance_uuid
        self.client = None
        self.connection_issue = True
        self.keep_running = True
        self.subscriptions = {}
        self.outbound_msg_queue = []

        self.call_table = {}
        self.call_table_lock = threading.RLock()
        self.outbound_client = client_redis(1)
        self.outbound_activemq = client_activemq()
        self.client_redis = client_redis(4)
        time.sleep(0.25)

        self.client_redis.subscribe(
            '/topic/call_management/new_call/%s' % instance_uuid, self,
            self.process_new_call.im_func)
        self.client_redis.subscribe(
            '/topic/call_management/timeout/%s' % instance_uuid, self,
            self.process_call_timeout.im_func)
 def notify_demod_new(self, demod_instance_uuid):
     self.log.info('Notified of new demod %s' % (demod_instance_uuid))
     self.amq_clients[demod_instance_uuid] = client_redis(4)
     self.amq_clients[demod_instance_uuid].subscribe(
         '/topic/raw_control/%s' % (demod_instance_uuid), self,
         self.process_raw_control.im_func, False)
     self.instance_locks[demod_instance_uuid] = threading.RLock()
Пример #3
0
    def notify_demod_new(self, demod_instance_uuid):
        self.log.debug('Notified of new demod %s' % (demod_instance_uuid))
        self.amq_clients[demod_instance_uuid] = client_redis(4)
        self.amq_clients[demod_instance_uuid].subscribe(
            '/topic/raw_control/%s' % (demod_instance_uuid), self,
            self.process_raw_control.im_func)

        #'packet_type = \'GRP_V_CH_GRANT\' or packet_type = \'MOT_PAT_GRP_VOICE_CHAN_GRANT\' or packet_type = \'GRP_V_CH_GRANT_UPDT\' or packet_type = \'MOT_PAT_GRP_VOICE_CHAN_GRANT_UPDT\' or packet_type = \'MOT_PAT_GRP_ADD_CMD\' or packet_type = \'MOT_PAT_GRP_DEL_CMD\' or packet_type = \'IDEN_UP\' or packet_type = \'IDEN_UP_VU\' or packet_type = \'IDEN_UP_TDMA\'')
        self.amq_clients[demod_instance_uuid].subscribe(
            '/topic/raw_voice/%s' % (demod_instance_uuid), self,
            self.process_raw_control.im_func)
        #'packet_type = \'Group Voice Channel User\' or packet_type = \'Call Termination / Cancellation\' or packet_type = \'Group Voice Channel Update\'')
        self.instance_locks[demod_instance_uuid] = threading.RLock()
Пример #4
0
    def __init__(self, system, site_uuid, overseer_uuid):

        gr.top_block.__init__(self, "moto receiver")

        ##################################################
        # Variables
        ##################################################

        self.instance_uuid = '%s' % uuid.uuid4()
        self.log = logging.getLogger('overseer.moto_control_demod.%s' %
                                     self.instance_uuid)
        self.log.info('Initializing instance: %s site: %s overseer: %s' %
                      (self.instance_uuid, site_uuid, overseer_uuid))
        self.overseer_uuid = overseer_uuid
        self.site_uuid = site_uuid

        self.channel_rate = 12500

        self.packets = 0
        self.packets_bad = 0
        self.patches = {}

        self.quality = []
        self.site_detail = {}

        self.symbol_rate = symbol_rate = 3600.0
        self.control_source = 0

        self.offset = offset = 0
        self.is_locked = False

        self.system = system

        self.system_id = system['id']
        self.channels = system['channels']
        self.channels_list = self.channels.keys()

        self.thread_id = '%s-%s' % (self.system['type'], self.system_id)

        self.control_channel_key = 0
        self.control_channel = control_channel = self.channels[
            self.channels_list[0]]

        self.option_dc_offset = False
        self.option_udp_sink = False

        self.enable_capture = True
        self.keep_running = True

        ##################################################
        # Message Queues
        ##################################################
        self.control_msg_sink_msgq = gr.msg_queue(1024)

        ##################################################
        # Threads
        ##################################################

        receive_engine = threading.Thread(target=self.receive_engine)
        receive_engine.daemon = True
        receive_engine.start()

        quality_check = threading.Thread(target=self.quality_check)
        quality_check.daemon = True
        quality_check.start()

        self.connector = frontend_connector()
        self.redis_demod_publisher = redis_demod_publisher(parent_demod=self)
        self.client_redis = client_redis()

        ##################################################
        # Blocks
        ##################################################

        self.source = None

        control_sample_rate = 12500
        channel_rate = control_sample_rate * 2

        self.control_quad_demod = analog.quadrature_demod_cf(5)

        if (self.option_dc_offset):
            moving_sum = blocks.moving_average_ff(1000, 1, 4000)
            divide_const = blocks.multiply_const_vff((0.001, ))
            self.probe = blocks.probe_signal_f()

        self.control_clock_recovery = digital.clock_recovery_mm_ff(
            channel_rate / symbol_rate, 1.4395919, 0.5, 0.05, 0.005)
        self.control_binary_slicer = digital.binary_slicer_fb()
        self.control_byte_pack = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.control_msg_sink = blocks.message_sink(gr.sizeof_char * 1,
                                                    self.control_msg_sink_msgq,
                                                    True)

        if (self.option_udp_sink):
            self.udp = blocks.udp_sink(gr.sizeof_gr_complex * 1, "127.0.0.1",
                                       self.system_id, 1472, True)

        moving_sum = blocks.moving_average_ff(10000, 1, 40000)
        subtract = blocks.sub_ff(1)
        divide_const = blocks.multiply_const_vff((0.0001, ))
        self.probe = blocks.probe_signal_f()
        self.connect(self.control_quad_demod, moving_sum, divide_const,
                     self.probe)

        ##################################################
        # Connections
        ##################################################

        self.connect(self.control_quad_demod, self.control_clock_recovery)
        self.connect(self.control_clock_recovery, self.control_binary_slicer,
                     self.control_byte_pack, self.control_msg_sink)

        if (self.option_dc_offset):
            self.connect(self.control_quad_demod, moving_sum, divide_const,
                         self.probe)

        if (self.option_udp_sink):
            self.connect(self.control_prefilter, self.udp)

        self.tune_next_control()
    def __init__(self, system, site_uuid, overseer_uuid):

        gr.top_block.__init__(self, "p25 receiver")

        #set globals
        self.is_locked = False
        self.system = system
        self.instance_uuid = '%s' % uuid.uuid4()

        self.log = logging.getLogger('overseer.p25_control_demod.%s' %
                                     self.instance_uuid)
        self.protocol_log = logging.getLogger('protocol.%s' %
                                              self.instance_uuid)
        self.log.info('Initializing instance: %s site: %s overseer: %s' %
                      (self.instance_uuid, site_uuid, overseer_uuid))

        self.site_uuid = site_uuid
        self.overseer_uuid = overseer_uuid

        self.control_channel = system['channels'][
            system['default_control_channel']]
        self.control_channel_i = system['default_control_channel']

        self.channel_identifier_table = {}

        try:
            self.modulation = system['modulation']
        except:
            self.modulation = 'C4FM'

        self.channel_rate = 12500
        symbol_rate = 4800

        self.site_detail = {}
        self.site_detail['WACN ID'] = None
        self.site_detail['System ID'] = None
        self.site_detail['Control Channel'] = None
        self.site_detail['System Service Class'] = None
        self.site_detail['Site ID'] = None
        self.site_detail['RF Sub-system ID'] = None
        self.site_detail['RFSS Network Connection'] = None

        self.bad_messages = 0
        self.total_messages = 0
        self.quality = []

        self.keep_running = True

        self.source = None

        # channel filter
        channel_rate = self.channel_rate * 2
        self.control_prefilter = filter.freq_xlating_fir_filter_ccc(
            1, (1, ), 0, channel_rate)

        # power squelch
        #power_squelch = gr.pwr_squelch_cc(squelch, 1e-3, 0, True)
        #self.connect(self.channel_filter, power_squelch)

        autotuneq = gr.msg_queue(2)
        self.demod_watcher = demod_watcher(self)
        self.symbol_deviation = 600.0

        if self.modulation == 'C4FM':
            # FM demodulator
            fm_demod_gain = channel_rate / (2.0 * pi * self.symbol_deviation)
            self.fm_demod = fm_demod = analog.quadrature_demod_cf(
                fm_demod_gain)

            moving_sum = blocks.moving_average_ff(10000, 1, 40000)
            subtract = blocks.sub_ff(1)
            divide_const = blocks.multiply_const_vff((0.0001, ))
            self.probe = blocks.probe_signal_f()
            self.connect(self.fm_demod, moving_sum, divide_const, self.probe)

            # symbol filter
            symbol_decim = 1
            samples_per_symbol = channel_rate // symbol_rate
            symbol_coeffs = (1.0 / samples_per_symbol, ) * samples_per_symbol
            symbol_filter = filter.fir_filter_fff(symbol_decim, symbol_coeffs)

            demod_fsk4 = op25.fsk4_demod_ff(autotuneq, channel_rate,
                                            symbol_rate)
        elif self.modulation == 'CQPSK':
            # FM demodulator
            fm_demod_gain = channel_rate / (2.0 * pi * self.symbol_deviation)
            self.fm_demod = fm_demod = analog.quadrature_demod_cf(
                fm_demod_gain)

            moving_sum = blocks.moving_average_ff(10000, 1, 40000)
            subtract = blocks.sub_ff(1)
            divide_const = blocks.multiply_const_vff((0.0001, ))
            self.probe = blocks.probe_signal_f()
            self.connect(fm_demod, moving_sum, divide_const, self.probe)

            #self.resampler = filter.pfb.arb_resampler_ccf(float(48000)/float(channel_rate))
            self.resampler = blocks.multiply_const_cc(1.0)
            self.agc = analog.feedforward_agc_cc(1024, 1.0)
            self.symbol_filter_c = blocks.multiply_const_cc(1.0)

            gain_mu = 0.025
            omega = float(channel_rate) / float(symbol_rate)
            gain_omega = 0.1 * gain_mu * gain_mu

            alpha = 0.04
            beta = 0.125 * alpha * alpha
            fmax = 1200  # Hz
            fmax = 2 * pi * fmax / float(channel_rate)

            self.clock = repeater.gardner_costas_cc(omega, gain_mu, gain_omega,
                                                    alpha, beta, fmax, -fmax)
            self.diffdec = digital.diff_phasor_cc()
            self.to_float = blocks.complex_to_arg()
            self.rescale = blocks.multiply_const_ff((1 / (pi / 4)))

    # symbol slicer
        levels = [-2.0, 0.0, 2.0, 4.0]
        slicer = op25.fsk4_slicer_fb(levels)

        # frame decoder
        self.decodequeue = decodequeue = gr.msg_queue(1000)
        qsink = blocks.message_sink(gr.sizeof_char, self.decodequeue, False)
        self.decoder = decoder = repeater.p25_frame_assembler(
            '', 0, 0, False, True, True, autotuneq, False, False)

        if self.modulation == 'C4FM':
            self.connect(self.control_prefilter, fm_demod, symbol_filter,
                         demod_fsk4, slicer, decoder, qsink)
        elif self.modulation == 'CQPSK':
            self.connect(self.resampler, self.agc, self.symbol_filter_c,
                         self.clock, self.diffdec, self.to_float, self.rescale,
                         slicer, decoder, qsink)

##################################################
# Threads
##################################################
        self.connector = frontend_connector()
        self.client_redis = client_redis()
        self.redis_demod_publisher = redis_demod_publisher(parent_demod=self)

        quality_check_0 = threading.Thread(target=self.quality_check)
        quality_check_0.daemon = True
        quality_check_0.start()
        # Adjust the channel offset
        #
        self.tune_next_control_channel()

        #self.receive_engine()

        receive_engine = threading.Thread(target=self.receive_engine)
        receive_engine.daemon = True
        receive_engine.start()
Пример #6
0
	def __init__(self, system, site_uuid, overseer_uuid):
		gr.top_block.__init__(self, "edacs receiver")
                self.log = logging.getLogger('overseer.edacs_control_demod')

		self.system = system
		self.instance_uuid = '%s' % uuid.uuid4()
                self.log = logging.getLogger('overseer.edacs_control_demod.%s' % self.instance_uuid)
		self.protocol_log = logging.getLogger('protocol.%s' % self.instance_uuid)
                self.log.info('Initializing instance: %s site: %s overseer: %s' % (self.instance_uuid, site_uuid, overseer_uuid))

		self.overseer_uuid = overseer_uuid
		self.site_uuid = site_uuid

		self.audio_rate = audio_rate = 12500
		self.symbol_rate = symbol_rate = system['symbol_rate']
		self.channels = channels = system['channels']
		self.channels_list = self.channels.keys()
		self.control_channel_key = 8
                self.control_channel = control_channel = self.channels[self.channels_list[0]]
		self.control_source = 0

		self.thread_id = '%s-%s' % (self.system['type'], self.system['id'])

		self.control_lcn = control_lcn = 1
		self.bad_messages = 0
		self.total_messages = 0
		self.quality = []
		self.site_detail = {}

		self.is_locked = False

		self.enable_capture = True
		self.keep_running = True

		self.freq_offset = 0

		self.connector = frontend_connector()
		self.client_redis = client_redis()

		################################################
		# Blocks
		################################################
	

		self.channel_rate = 12500
		self.receive_rate = self.channel_rate*2 #Decimation adds 50% on either side

		self.source = None


		try:
			self.control_quad_demod = gr.quadrature_demod_cf(5)
		except:
			self.control_quad_demod = analog.quadrature_demod_cf(5)
		self.control_clock_recovery = digital.clock_recovery_mm_ff(self.receive_rate/symbol_rate, 1.4395919, 0.5, 0.05, 0.005)
                self.control_binary_slicer = digital.binary_slicer_fb()
		try:
			self.control_unpacked_to_packed = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
		except:
			self.control_unpacked_to_packed = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
		self.control_msg_queue = gr.msg_queue(1024000)
		try:
			self.control_msg_sink = gr.message_sink(gr.sizeof_char, self.control_msg_queue,True)
		except:
			self.control_msg_sink = blocks.message_sink(gr.sizeof_char, self.control_msg_queue,True)

		#offset measurement
                moving_sum = blocks.moving_average_ff(10000, 1, 40000)
                subtract = blocks.sub_ff(1)
                divide_const = blocks.multiply_const_vff((0.0001, ))
                self.probe = blocks.probe_signal_f()


		################################################
		# Connections
		################################################
	
		self.connect(   self.control_quad_demod,
                                self.control_clock_recovery,
                                self.control_binary_slicer,
                                self.control_unpacked_to_packed,
				self.control_msg_sink)

		self.connect(self.control_quad_demod, moving_sum, divide_const, self.probe)
		

		###############################################
		self.patches = {}
		self.patch_timeout = 3 #seconds
		self.redis_demod_publisher = redis_demod_publisher(parent_demod=self)

		control_decode_0 = threading.Thread(target=self.control_decode)
		control_decode_0.daemon = True
		control_decode_0.start()

                quality_check_0 = threading.Thread(target=self.quality_check)
                quality_check_0.daemon = True
                quality_check_0.start()

		self.tune_next_control_channel()