add the ability to disable devices

This commit is contained in:
Jakob Ketterl
2021-02-21 18:11:08 +01:00
parent 7f3d421b25
commit bd31fa5149
2 changed files with 22 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
from owrx.config import Config
from owrx.property import PropertyLayer
from owrx.feature import FeatureDetector, UnknownFeatureException
from owrx.source import SdrSourceState
import logging
@@ -78,4 +79,8 @@ class SdrService(object):
module = __import__("owrx.source.{0}".format(sdrType), fromlist=[className])
cls = getattr(module, className)
SdrService.sources[id] = cls(id, props)
return {key: s for key, s in SdrService.sources.items() if not s.isFailed()}
return {
key: s
for key, s in SdrService.sources.items()
if s.getState() not in [SdrSourceState.FAILED, SdrSourceState.DISABLED]
}