Ejemplo n.º 1
0
	def set_frequencies(self, freq_list, skip_lock=False):	# FIXME: Filter duplicate frequencies / connect Null Sink if freq list is empty / Lock
		current_freqs = []
		map_freqs = {}
		for decoder in self.decoders:
			current_freqs += [decoder.get_freq()]
			map_freqs[decoder.get_freq()] = decoder
		create = [f for f in freq_list if f not in current_freqs]
		remove = [f for f in current_freqs if f not in freq_list]
		if not skip_lock: self.lock()
		try:
			decoder_factory = self.decoder
			if isinstance(self.decoder, str):
				decoder_factory = eval(self.decoder)
			#factory_eval_str = "decoder_factory(baseband_freq=%s,freq=%f,%s)" % (self.baseband_freq, f, self.decoder_args)
			for f in create:
				#d = eval(factory_eval_str)
				combined_args = self.kwargs
				combined_args['baseband_freq'] = self.baseband_freq
				combined_args['freq'] = f
				if f in self.per_freq_params:
					for k in self.per_freq_params[f].keys():
						combined_args[k] = self.per_freq_params[f][k]
				print "==> Creating decoder:", decoder_factory, "with", combined_args
				#d = decoder_factory(baseband_freq=self.baseband_freq, freq=f, **combined_args)
				d = decoder_factory(**combined_args)
				d._msgq_relay = message_relay.message_relay(self.msgq, d.msg_out.msgq())
				self.connect(self, d)
				self.decoders += [d]
		except Exception, e:
			print "Failed to create decoder:", e#, factory_eval_str
Ejemplo n.º 2
0
 def set_frequencies(self, freq_list):
     current_freqs = []
     map_freqs = {}
     for decoder in self.decoders:
         current_freqs += [decoder.get_freq()]
         map_freqs[decoder.get_freq()] = decoder
     create = [f for f in freq_list if f not in current_freqs]
     remove = [f for f in current_freqs if f not in freq_list]
     try:
         decoder_factory = self.decoder
         if isinstance(self.decoder, str):
             decoder_factory = eval(self.decoder)
         #factory_eval_str = "decoder_factory(baseband_freq=%s,freq=%f,%s)" % (self.baseband_freq, f, self.decoder_args)
         for f in create:
             #d = eval(factory_eval_str)
             combined_args = self.kwargs
             combined_args['baseband_freq'] = self.baseband_freq
             combined_args['freq'] = f
             if f in self.per_freq_params:
                 for k in self.per_freq_params[f].keys():
                     combined_args[k] = self.per_freq_params[f][k]
             print "==> Creating decoder:", decoder_factory, "with", combined_args
             #d = decoder_factory(baseband_freq=self.baseband_freq, freq=f, **combined_args)
             d = decoder_factory(**combined_args)
             d._msgq_relay = message_relay.message_relay(
                 self.msgq, d.msg_out.msgq())
             self.connect(self, d)
             self.decoders += [d]
     except Exception, e:
         print "Failed to create decoder:", e  #, factory_eval_str
 def set_frequencies(
     self,
     freq_list,
     skip_lock=False
 ):  # FIXME: Filter duplicate frequencies / connect Null Sink if freq list is empty / Lock
     # print "set_frequencies:", freq_list, "lock:", skip_lock
     current_freqs = []
     map_freqs = {}
     for decoder in self.decoders:
         current_freqs += [decoder.get_freq()]
         map_freqs[decoder.get_freq()] = decoder
     create = [f for f in freq_list if f not in current_freqs]
     remove = [f for f in current_freqs if f not in freq_list]
     if len(create) == 0 and len(remove) == 0:
         # print "No channels to create/remove"
         return
     if not skip_lock: self.lock()
     try:
         decoder_factory = self.decoder
         if isinstance(self.decoder, str):
             decoder_factory = eval(self.decoder)
         #factory_eval_str = "decoder_factory(baseband_freq=%s,freq=%f,%s)" % (self.baseband_freq, f, self.decoder_args)
         cnt = 0
         for f in create:
             cnt += 1
             #d = eval(factory_eval_str)
             combined_args = self.kwargs
             combined_args['baseband_freq'] = self.baseband_freq
             combined_args['freq'] = f
             if f in self.per_freq_params:
                 for k in self.per_freq_params[f].keys():
                     combined_args[k] = self.per_freq_params[f][k]
             print "==> Creating decoder {}/{}:".format(
                 cnt, len(create)), decoder_factory, "with", combined_args
             #d = decoder_factory(baseband_freq=self.baseband_freq, freq=f, **combined_args)
             d = decoder_factory(**combined_args)
             if self.msgq is not None:
                 try:
                     d._msgq_relay = message_relay.message_relay(
                         self.msgq, d.msg_out.msgq())
                 except Exception, e:
                     print "Exception while creating message relay:", e
             else:
                 try:
                     self.msg_connect((d, 'out'), (self, 'out'))
                     # print "Connected message ports (from: {})".format(d)
                 except Exception, e:
                     print "Exception while connecting output message ports:", e
             self.connect(self, d)
             self.decoders += [d]
Ejemplo n.º 4
0
	def set_frequencies(self, freq_list, skip_lock=False):	# FIXME: Filter duplicate frequencies / connect Null Sink if freq list is empty / Lock
		# print "set_frequencies:", freq_list, "lock:", skip_lock
		current_freqs = []
		map_freqs = {}
		for decoder in self.decoders:
			current_freqs += [decoder.get_freq()]
			map_freqs[decoder.get_freq()] = decoder
		create = [f for f in freq_list if f not in current_freqs]
		remove = [f for f in current_freqs if f not in freq_list]
		if len(create) == 0 and len(remove) == 0:
			# print "No channels to create/remove"
			return
		if not skip_lock: self.lock()
		try:
			decoder_factory = self.decoder
			if isinstance(self.decoder, str):
				decoder_factory = eval(self.decoder)
			#factory_eval_str = "decoder_factory(baseband_freq=%s,freq=%f,%s)" % (self.baseband_freq, f, self.decoder_args)
			cnt = 0
			for f in create:
				cnt += 1
				#d = eval(factory_eval_str)
				combined_args = self.kwargs
				combined_args['baseband_freq'] = self.baseband_freq
				combined_args['freq'] = f
				if f in self.per_freq_params:
					for k in self.per_freq_params[f].keys():
						combined_args[k] = self.per_freq_params[f][k]
				print "==> Creating decoder {}/{}:".format(cnt, len(create)), decoder_factory, "with", combined_args
				#d = decoder_factory(baseband_freq=self.baseband_freq, freq=f, **combined_args)
				d = decoder_factory(**combined_args)
				if self.msgq is not None:
					try:
						d._msgq_relay = message_relay.message_relay(self.msgq, d.msg_out.msgq())
					except Exception, e:
						print "Exception while creating message relay:", e
				else:
					try:
						self.msg_connect((d, 'out'), (self, 'out'))
						# print "Connected message ports (from: {})".format(d)
					except Exception, e:
						print "Exception while connecting output message ports:", e
				self.connect(self, d)
				self.decoders += [d]
Ejemplo n.º 5
0
	def set_frequencies(self, freq_list):
		current_freqs = []
		map_freqs = {}
		for decoder in self.decoders:
			current_freqs += [decoder.get_freq()]
			map_freqs[decoder.get_freq()] = decoder
		create = [f for f in freq_list if f not in current_freqs]
		remove = [f for f in current_freqs if f not in freq_list]
		try:
			decoder_factory = self.decoder
			if isinstance(self.decoder, str):
				decoder_factory = eval(self.decoder)
			#factory_eval_str = "decoder_factory(baseband_freq=%s,freq=%f,%s)" % (self.baseband_freq, f, self.decoder_args)
			for f in create:
				#d = eval(factory_eval_str)
				d = decoder_factory(baseband_freq=self.baseband_freq, freq=f, **self.kwargs)
				d._msgq_relay = message_relay.message_relay(self.msgq, d.msg_out.msgq())
				self.connect(self, d)
				self.decoders += [d]
		except Exception, e:
			print "Failed to create decoder:", e#, factory_eval_str