refactor state handling: uncouple failed and enabled flags

This commit is contained in:
Jakob Ketterl
2021-03-18 19:34:53 +01:00
parent 916f19ac60
commit b25a673829
7 changed files with 66 additions and 43 deletions

View File

@@ -231,7 +231,7 @@ class ServiceScheduler(SdrSourceEventClient):
self.source.removeClient(self)
def scheduleSelection(self, time=None):
if self.source.getState() is SdrSourceState.FAILED:
if self.source.isFailed():
return
seconds = 10
if time is not None:
@@ -254,8 +254,9 @@ class ServiceScheduler(SdrSourceEventClient):
def onStateChange(self, state: SdrSourceState):
if state is SdrSourceState.STOPPING:
self.scheduleSelection()
elif state is SdrSourceState.FAILED:
self.shutdown()
def onFail(self):
self.shutdown()
def onBusyStateChange(self, state: SdrBusyState):
if state is SdrBusyState.IDLE: