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

@@ -2,7 +2,7 @@ from owrx.config.core import CoreConfig
from owrx.config import Config
from csdr import csdr
import threading
from owrx.source import SdrSourceEventClient, SdrSourceState, SdrBusyState, SdrClientClass
from owrx.source import SdrSourceEventClient, SdrSourceState, SdrClientClass
from owrx.property import PropertyStack
import logging
@@ -77,10 +77,10 @@ class SpectrumThread(csdr.output, SdrSourceEventClient):
return SdrClientClass.USER
def onStateChange(self, state: SdrSourceState):
if state in [SdrSourceState.STOPPING, SdrSourceState.FAILED]:
if state is SdrSourceState.STOPPING:
self.dsp.stop()
elif state is SdrSourceState.RUNNING:
self.dsp.start()
def onBusyStateChange(self, state: SdrBusyState):
pass
def onFail(self):
self.dsp.stop()