Exemplo n.º 1
0
	def audio_channel_add(self, args):

		(sys_id, chan, group_id, radio_id) = args
		print "sys_id: %x, freq: %f, group: %x, radio: %d" % (sys_id, get_freq(chan), group_id, radio_id)

		self._ac_lock.acquire()
		ab_to_remove = None
		if chan in self._audio_channel_list:
			c = self._audio_channels[chan]
			if c['group_id'] == group_id:
				c['radio_ids'].append([radio_id, time.time()]) # even if None
				self._ac_lock.release()
				return

			# group changed; that session must be over
			ab_to_remove = self._audio_channels[chan]['audio_block']
			del self._audio_channel_list[self._audio_channel_list.index(chan)]	# XXX write metadata about call
			del self._audio_channels[chan]

		# we have a new session
		ac = audio_channel(self._bandwidth, get_freq(chan) * 1e6 - self._center_freq, sys_id, chan, group_id, self._save_dir)

		print "stop flow graph"

		# XXX bug: python block requires stop
		self.stop()
		self.wait()
		self.lock()

		print "connecting"
		if ab_to_remove is not None:
			self.disconnect(ab_to_remove)
		self.connect(self.u, ac)

		print "starting"
		self.unlock()
		self.start()

		print "started"

		# remember it
		self._audio_channels[chan] = {'group_id': group_id, 'radio_ids': [[radio_id, time.time()],], 'audio_block': ac}
		self._audio_channel_list.append(chan)

		self._ac_lock.release()
Exemplo n.º 2
0
def main():

	for c in range(1024):
		freq = band_plan_800.get_freq(c)
		chan = 0
		if freq is not None:
			chan = band_plan_800.get_chan(freq)
			if chan != c:
				print "%d -> %f -> %d" % (c, freq, chan)


	for i in range(1520):
		f = 851.0 + i * 0.0125
		chan = band_plan_800.get_chan(f)
		if chan is not None:
			freq = band_plan_800.get_freq(chan)
			if round(freq - f, 6) != 0:
				print "%f -> %d -> %f" % (f, chan, freq)


	return 0
Exemplo n.º 3
0
	def control_channel_add(self, chan):

		self._cc_lock.acquire()
		if chan in self._control_channel_list:
			# we're already monitoring this control channel
			self._cc_lock.release()
			return

		# XXX group description csv
		cc = control_channel(self._bandwidth, get_freq(chan) * 1e6 - self._center_freq, queue = self._cc_msg_q, logger = self._logger, group_description_csv = "./SERS.groups.csv")
		self.lock()
		self.connect(self.u, cc)
		self.unlock()

		# remember this control channel
		self._control_channels[chan] = {'sys_id': -1, 'cc_block': cc}
		self._control_channel_list.append(chan)
		self._cc_lock.release()