use automatic ports unless explicitly configured
This commit is contained in:
parent
42789ed561
commit
70347d1ef9
@ -237,13 +237,6 @@ sdrs = {
|
||||
},
|
||||
}
|
||||
|
||||
# ==== Misc settings ====
|
||||
|
||||
iq_port_range = [
|
||||
4950,
|
||||
4960,
|
||||
] # TCP port for range ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default.
|
||||
|
||||
# ==== Color themes ====
|
||||
|
||||
# A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels
|
||||
|
15
owrx/sdr.py
15
owrx/sdr.py
@ -1,6 +1,5 @@
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector, UnknownFeatureException
|
||||
import sys
|
||||
|
||||
import logging
|
||||
|
||||
@ -12,18 +11,6 @@ class SdrService(object):
|
||||
sources = {}
|
||||
lastPort = None
|
||||
|
||||
@staticmethod
|
||||
def getNextPort():
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
(start, end) = pm["iq_port_range"]
|
||||
if SdrService.lastPort is None:
|
||||
SdrService.lastPort = start
|
||||
else:
|
||||
SdrService.lastPort += 1
|
||||
if SdrService.lastPort > end:
|
||||
raise IndexError("no more available ports to start more sdrs")
|
||||
return SdrService.lastPort
|
||||
|
||||
@staticmethod
|
||||
def loadProps():
|
||||
if SdrService.sdrProps is None:
|
||||
@ -90,5 +77,5 @@ class SdrService(object):
|
||||
className = "".join(x for x in sdrType.title() if x.isalnum()) + "Source"
|
||||
module = __import__("owrx.source.{0}".format(sdrType), fromlist=[className])
|
||||
cls = getattr(module, className)
|
||||
SdrService.sources[id] = cls(id, props, SdrService.getNextPort())
|
||||
SdrService.sources[id] = cls(id, props)
|
||||
return {key: s for key, s in SdrService.sources.items() if not s.isFailed()}
|
||||
|
@ -8,6 +8,7 @@ import time
|
||||
import signal
|
||||
from abc import ABC, abstractmethod
|
||||
from owrx.command import CommandMapper
|
||||
from owrx.socket import getAvailablePort
|
||||
|
||||
import logging
|
||||
|
||||
@ -29,7 +30,7 @@ class SdrSource(ABC):
|
||||
CLIENT_BACKGROUND = 1
|
||||
CLIENT_USER = 2
|
||||
|
||||
def __init__(self, id, props, port):
|
||||
def __init__(self, id, props):
|
||||
self.id = id
|
||||
self.props = props
|
||||
self.profile_id = None
|
||||
@ -38,7 +39,10 @@ class SdrSource(ABC):
|
||||
self.wireEvents()
|
||||
self.commandMapper = CommandMapper()
|
||||
|
||||
self.port = port
|
||||
if "port" in props and props["port"] is not None:
|
||||
self.port = props["port"]
|
||||
else:
|
||||
self.port = getAvailablePort()
|
||||
self.monitor = None
|
||||
self.clients = []
|
||||
self.spectrumClients = []
|
||||
|
@ -3,8 +3,8 @@ from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class AirspySource(SoapyConnectorSource):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.getCommandMapper().setMappings({"bias_tee": Flag("-t biastee=true")})
|
||||
|
||||
def getDriver(self):
|
||||
|
@ -9,8 +9,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConnectorSource(SdrSource):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.controlSocket = None
|
||||
self.controlPort = getAvailablePort()
|
||||
self.getCommandMapper().setMappings(
|
||||
|
@ -3,8 +3,8 @@ from .direct import DirectSource
|
||||
|
||||
|
||||
class FifiSdrSource(DirectSource):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.getCommandMapper().setBase("arecord").setMappings(
|
||||
{"device": Option("-D"), "samp_rate": Option("-r")}
|
||||
).setStatic("-f S16_LE -c2 -")
|
||||
|
@ -3,8 +3,8 @@ from owrx.command import Flag, Option
|
||||
|
||||
|
||||
class HackrfSource(DirectSource):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.getCommandMapper().setBase("hackrf_transfer").setMappings(
|
||||
{
|
||||
"samp_rate": Option("-s"),
|
||||
|
@ -15,7 +15,7 @@ class Resampler(DirectSource):
|
||||
def onPropertyChange(self, name, value):
|
||||
logger.warning("Resampler is unable to handle property change ({0} changed to {1})".format(name, value))
|
||||
|
||||
def __init__(self, props, port, sdr):
|
||||
def __init__(self, props, sdr):
|
||||
sdrProps = sdr.getProps()
|
||||
self.shift = (sdrProps["center_freq"] - props["center_freq"]) / sdrProps["samp_rate"]
|
||||
self.decimation = int(float(sdrProps["samp_rate"]) / props["samp_rate"])
|
||||
@ -24,7 +24,7 @@ class Resampler(DirectSource):
|
||||
props["samp_rate"] = if_samp_rate
|
||||
|
||||
self.sdr = sdr
|
||||
super().__init__(None, props, port)
|
||||
super().__init__(None, props)
|
||||
|
||||
def getCommand(self):
|
||||
return [
|
||||
|
@ -2,6 +2,6 @@ from .connector import ConnectorSource
|
||||
|
||||
|
||||
class RtlSdrSource(ConnectorSource):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.getCommandMapper().setBase("rtl_connector")
|
||||
|
@ -5,8 +5,8 @@ from .connector import ConnectorSource
|
||||
|
||||
|
||||
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
|
||||
def __init__(self, id, props, port):
|
||||
super().__init__(id, props, port)
|
||||
def __init__(self, id, props):
|
||||
super().__init__(id, props)
|
||||
self.getCommandMapper().setBase("soapy_connector").setMappings({"antenna": Option("-a")})
|
||||
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user