Adding display of active clients.
This commit is contained in:
parent
70e75c7a81
commit
2d8421302a
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenWebRX+ Clients</title>
|
<title>OpenWebRX+ Connected Clients</title>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
||||||
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="static/css/admin.css" />
|
<link rel="stylesheet" type="text/css" href="static/css/admin.css" />
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
${header}
|
${header}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h1 class="col-12">Clients</h1>
|
<h1 class="col-12">Connected Clients</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input class="form-control form-control-sm" id="broadcast-text" placeholder="Message to broadcast to all clients" type="text" />
|
<input class="form-control form-control-sm" id="broadcast-text" placeholder="Message to broadcast to all clients" type="text" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>OpenWebRX+ Active Services</title>
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
||||||
|
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="static/css/admin.css" />
|
||||||
|
<script src="compiled/settings.js"></script>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
${header}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<h1 class="col-12">Active Services</h1>
|
||||||
|
</div>
|
||||||
|
<div class="row service-list">
|
||||||
|
${services}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
@ -49,5 +49,15 @@ ${header}
|
||||||
<div class="row client-list">
|
<div class="row client-list">
|
||||||
${clients}
|
${clients}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<h1 class="col-12">Services</h1>
|
||||||
|
</div>
|
||||||
|
<div class="row service-list">
|
||||||
|
${services}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from owrx.config import Config
|
||||||
from owrx.controllers.admin import AuthorizationMixin
|
from owrx.controllers.admin import AuthorizationMixin
|
||||||
from owrx.controllers.template import WebpageController
|
from owrx.controllers.template import WebpageController
|
||||||
from owrx.controllers.clients import ClientController
|
from owrx.controllers.clients import ClientController
|
||||||
|
from owrx.controllers.services import ServiceController
|
||||||
from owrx.breadcrumb import Breadcrumb, BreadcrumbItem, BreadcrumbMixin
|
from owrx.breadcrumb import Breadcrumb, BreadcrumbItem, BreadcrumbMixin
|
||||||
from owrx.websocket import WebSocketConnection
|
from owrx.websocket import WebSocketConnection
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
@ -19,6 +20,7 @@ class SettingsController(AuthorizationMixin, WebpageController):
|
||||||
def template_variables(self):
|
def template_variables(self):
|
||||||
variables = super().template_variables()
|
variables = super().template_variables()
|
||||||
variables["clients"] = ClientController.renderClients()
|
variables["clients"] = ClientController.renderClients()
|
||||||
|
variables["services"] = ServiceController.renderServices()
|
||||||
return variables
|
return variables
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from owrx.controllers.websocket import WebSocketController
|
||||||
from owrx.controllers.api import ApiController
|
from owrx.controllers.api import ApiController
|
||||||
from owrx.controllers.metrics import MetricsController
|
from owrx.controllers.metrics import MetricsController
|
||||||
from owrx.controllers.clients import ClientController
|
from owrx.controllers.clients import ClientController
|
||||||
|
from owrx.controllers.services import ServiceController
|
||||||
from owrx.controllers.settings import SettingsController
|
from owrx.controllers.settings import SettingsController
|
||||||
from owrx.controllers.settings.general import GeneralSettingsController
|
from owrx.controllers.settings.general import GeneralSettingsController
|
||||||
from owrx.controllers.settings.sdr import (
|
from owrx.controllers.settings.sdr import (
|
||||||
|
|
@ -162,6 +163,7 @@ class Router(object):
|
||||||
"/settings/decoding", DecodingSettingsController, method="POST", options={"action": "processFormData"}
|
"/settings/decoding", DecodingSettingsController, method="POST", options={"action": "processFormData"}
|
||||||
),
|
),
|
||||||
StaticRoute("/clients", ClientController),
|
StaticRoute("/clients", ClientController),
|
||||||
|
StaticRoute("/services", ServiceController),
|
||||||
StaticRoute("/ban", ClientController, method="POST", options={"action": "ban"}),
|
StaticRoute("/ban", ClientController, method="POST", options={"action": "ban"}),
|
||||||
StaticRoute("/unban", ClientController, method="POST", options={"action": "unban"}),
|
StaticRoute("/unban", ClientController, method="POST", options={"action": "unban"}),
|
||||||
StaticRoute("/broadcast", ClientController, method="POST", options={"action": "broadcast"}),
|
StaticRoute("/broadcast", ClientController, method="POST", options={"action": "broadcast"}),
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,8 @@ class ServiceHandler(SdrSourceEventClient):
|
||||||
else:
|
else:
|
||||||
chain.setBandPass(None, None)
|
chain.setBandPass(None, None)
|
||||||
chain.setReader(source.getBuffer().getReader())
|
chain.setReader(source.getBuffer().getReader())
|
||||||
|
chain.setFrequency(dial["frequency"])
|
||||||
|
chain.setMode(dial["mode"])
|
||||||
|
|
||||||
# dummy buffer, we don't use the output right now
|
# dummy buffer, we don't use the output right now
|
||||||
buffer = Buffer(chain.getOutputFormat())
|
buffer = Buffer(chain.getOutputFormat())
|
||||||
|
|
@ -392,3 +394,19 @@ class Services(object):
|
||||||
for scheduler in list(Services.schedulers.values()):
|
for scheduler in list(Services.schedulers.values()):
|
||||||
scheduler.shutdown()
|
scheduler.shutdown()
|
||||||
Services.schedulers = {}
|
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
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ from pycsdr.types import Format
|
||||||
|
|
||||||
class ServiceDemodulatorChain(Chain):
|
class ServiceDemodulatorChain(Chain):
|
||||||
def __init__(self, demod: BaseDemodulatorChain, secondaryDemod: ServiceDemodulator, sampleRate: int, frequencyOffset: int):
|
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 = Selector(sampleRate, secondaryDemod.getFixedAudioRate(), withSquelch=False)
|
||||||
self.selector.setFrequencyOffset(frequencyOffset)
|
self.selector.setFrequencyOffset(frequencyOffset)
|
||||||
|
|
||||||
|
|
@ -21,3 +24,15 @@ class ServiceDemodulatorChain(Chain):
|
||||||
|
|
||||||
def setBandPass(self, lowCut, highCut):
|
def setBandPass(self, lowCut, highCut):
|
||||||
self.selector.setBandpass(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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue