allow service configuration

This commit is contained in:
Jakob Ketterl 2019-07-28 13:29:45 +02:00
parent fa08009c50
commit 98c5e9e15b
2 changed files with 7 additions and 1 deletions

View File

@ -251,3 +251,6 @@ google_maps_api_key = ""
map_position_retention_time = 2 * 60 * 60 map_position_retention_time = 2 * 60 * 60
temporary_directory = "/tmp" temporary_directory = "/tmp"
services_enabled = True
services_decoders = ["ft8", "ft4", "wspr"]

View File

@ -3,6 +3,7 @@ from owrx.source import SdrService
from owrx.bands import Bandplan from owrx.bands import Bandplan
from csdr import dsp, output from csdr import dsp, output
from owrx.wsjt import WsjtParser from owrx.wsjt import WsjtParser
from owrx.config import PropertyManager
import logging import logging
@ -41,7 +42,7 @@ class ServiceHandler(object):
def isSupported(self, mode): def isSupported(self, mode):
# TODO make configurable # TODO make configurable
return mode in ["ft8", "ft4", "wspr"] return mode in PropertyManager.getSharedInstance()["services_decoders"]
def stopServices(self): def stopServices(self):
for service in self.services: for service in self.services:
@ -93,6 +94,8 @@ class ServiceManager(object):
return ServiceManager.sharedInstance return ServiceManager.sharedInstance
def start(self): def start(self):
if not PropertyManager.getSharedInstance()["services_enabled"]:
return
for source in SdrService.getSources().values(): for source in SdrService.getSources().values():
ServiceHandler(source) ServiceHandler(source)