diff --git a/htdocs/clients.html b/htdocs/clients.html index c5722033..5587bb04 100644 --- a/htdocs/clients.html +++ b/htdocs/clients.html @@ -1,7 +1,7 @@ - OpenWebRX+ Clients + OpenWebRX+ Connected Clients @@ -12,7 +12,7 @@ ${header}
-

Clients

+

Connected Clients

diff --git a/htdocs/services.html b/htdocs/services.html new file mode 100644 index 00000000..720166a7 --- /dev/null +++ b/htdocs/services.html @@ -0,0 +1,21 @@ + + + + OpenWebRX+ Active Services + + + + + + + +${header} +
+
+

Active Services

+
+
+ ${services} +
+
+ diff --git a/htdocs/settings.html b/htdocs/settings.html index 7126f793..dbc9667f 100644 --- a/htdocs/settings.html +++ b/htdocs/settings.html @@ -49,5 +49,15 @@ ${header}
${clients}
+
+

Services

+
+
+ ${services} +
+
+ + +
diff --git a/owrx/controllers/settings/__init__.py b/owrx/controllers/settings/__init__.py index e02404cc..ed3b14ab 100644 --- a/owrx/controllers/settings/__init__.py +++ b/owrx/controllers/settings/__init__.py @@ -2,6 +2,7 @@ from owrx.config import Config from owrx.controllers.admin import AuthorizationMixin from owrx.controllers.template import WebpageController from owrx.controllers.clients import ClientController +from owrx.controllers.services import ServiceController from owrx.breadcrumb import Breadcrumb, BreadcrumbItem, BreadcrumbMixin from owrx.websocket import WebSocketConnection from abc import ABCMeta, abstractmethod @@ -19,6 +20,7 @@ class SettingsController(AuthorizationMixin, WebpageController): def template_variables(self): variables = super().template_variables() variables["clients"] = ClientController.renderClients() + variables["services"] = ServiceController.renderServices() return variables diff --git a/owrx/http.py b/owrx/http.py index 2ccebf4e..9f276f44 100644 --- a/owrx/http.py +++ b/owrx/http.py @@ -7,6 +7,7 @@ from owrx.controllers.websocket import WebSocketController from owrx.controllers.api import ApiController from owrx.controllers.metrics import MetricsController from owrx.controllers.clients import ClientController +from owrx.controllers.services import ServiceController from owrx.controllers.settings import SettingsController from owrx.controllers.settings.general import GeneralSettingsController from owrx.controllers.settings.sdr import ( @@ -162,6 +163,7 @@ class Router(object): "/settings/decoding", DecodingSettingsController, method="POST", options={"action": "processFormData"} ), StaticRoute("/clients", ClientController), + StaticRoute("/services", ServiceController), StaticRoute("/ban", ClientController, method="POST", options={"action": "ban"}), StaticRoute("/unban", ClientController, method="POST", options={"action": "unban"}), StaticRoute("/broadcast", ClientController, method="POST", options={"action": "broadcast"}), diff --git a/owrx/service/__init__.py b/owrx/service/__init__.py index 9197efbe..3d756db5 100644 --- a/owrx/service/__init__.py +++ b/owrx/service/__init__.py @@ -276,6 +276,8 @@ class ServiceHandler(SdrSourceEventClient): else: chain.setBandPass(None, None) chain.setReader(source.getBuffer().getReader()) + chain.setFrequency(dial["frequency"]) + chain.setMode(dial["mode"]) # dummy buffer, we don't use the output right now buffer = Buffer(chain.getOutputFormat()) @@ -392,3 +394,19 @@ class Services(object): for scheduler in list(Services.schedulers.values()): scheduler.shutdown() Services.schedulers = {} + + @staticmethod + def listAll(): + result = [] + for handler in list(Services.handlers.values()): + sdr = handler.source.getName() + band = handler.source.getProfileName() + for service in handler.services: + if isinstance(service, ServiceDemodulatorChain): + result.append({ + "sdr" : sdr, + "band" : band, + "freq" : service.getFrequency(), + "mode" : service.getMode() + }) + return result diff --git a/owrx/service/chain.py b/owrx/service/chain.py index f71cf2bc..e62186df 100644 --- a/owrx/service/chain.py +++ b/owrx/service/chain.py @@ -6,6 +6,9 @@ from pycsdr.types import Format class ServiceDemodulatorChain(Chain): def __init__(self, demod: BaseDemodulatorChain, secondaryDemod: ServiceDemodulator, sampleRate: int, frequencyOffset: int): + self.frequency = None + self.mode = None + self.selector = Selector(sampleRate, secondaryDemod.getFixedAudioRate(), withSquelch=False) self.selector.setFrequencyOffset(frequencyOffset) @@ -21,3 +24,15 @@ class ServiceDemodulatorChain(Chain): def setBandPass(self, lowCut, highCut): self.selector.setBandpass(lowCut, highCut) + + def setFrequency(self, frequency): + self.frequency = frequency + + def setMode(self, mode): + self.mode = mode + + def getFrequency(self): + return self.frequency + + def getMode(self): + return self.mode