add the ability to schedule profiles to be used when sources are idle

This commit is contained in:
Jakob Ketterl
2019-09-16 00:31:35 +02:00
parent b0b2df5422
commit 8df4f9ce52
2 changed files with 165 additions and 27 deletions

View File

@ -243,16 +243,21 @@ class SdrSource(object):
def sleepOnRestart(self):
pass
def hasActiveClients(self):
activeClients = [c for c in self.clients if c.isActive()]
return len(activeClients) > 0
def addClient(self, c):
self.clients.append(c)
self.start()
if self.hasActiveClients():
self.start()
def removeClient(self, c):
try:
self.clients.remove(c)
except ValueError:
pass
if not self.clients:
if not self.hasActiveClients():
self.stop()
def addSpectrumClient(self, c):
@ -478,6 +483,9 @@ class SpectrumThread(csdr.output):
c.cancel()
self.subscriptions = []
def isActive(self):
return True
def onSdrAvailable(self):
self.dsp.start()
@ -606,6 +614,9 @@ class DspManager(csdr.output):
def setProperty(self, prop, value):
self.localProps.getProperty(prop).setValue(value)
def isActive(self):
return True
def onSdrAvailable(self):
logger.debug("received onSdrAvailable, attempting DspSource restart")
self.dsp.start()