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 ====
|
# ==== Color themes ====
|
||||||
|
|
||||||
# A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels
|
# 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.config import PropertyManager
|
||||||
from owrx.feature import FeatureDetector, UnknownFeatureException
|
from owrx.feature import FeatureDetector, UnknownFeatureException
|
||||||
import sys
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -12,18 +11,6 @@ class SdrService(object):
|
|||||||
sources = {}
|
sources = {}
|
||||||
lastPort = None
|
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
|
@staticmethod
|
||||||
def loadProps():
|
def loadProps():
|
||||||
if SdrService.sdrProps is None:
|
if SdrService.sdrProps is None:
|
||||||
@ -90,5 +77,5 @@ class SdrService(object):
|
|||||||
className = "".join(x for x in sdrType.title() if x.isalnum()) + "Source"
|
className = "".join(x for x in sdrType.title() if x.isalnum()) + "Source"
|
||||||
module = __import__("owrx.source.{0}".format(sdrType), fromlist=[className])
|
module = __import__("owrx.source.{0}".format(sdrType), fromlist=[className])
|
||||||
cls = getattr(module, 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()}
|
return {key: s for key, s in SdrService.sources.items() if not s.isFailed()}
|
||||||
|
@ -8,6 +8,7 @@ import time
|
|||||||
import signal
|
import signal
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from owrx.command import CommandMapper
|
from owrx.command import CommandMapper
|
||||||
|
from owrx.socket import getAvailablePort
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ class SdrSource(ABC):
|
|||||||
CLIENT_BACKGROUND = 1
|
CLIENT_BACKGROUND = 1
|
||||||
CLIENT_USER = 2
|
CLIENT_USER = 2
|
||||||
|
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.props = props
|
self.props = props
|
||||||
self.profile_id = None
|
self.profile_id = None
|
||||||
@ -38,7 +39,10 @@ class SdrSource(ABC):
|
|||||||
self.wireEvents()
|
self.wireEvents()
|
||||||
self.commandMapper = CommandMapper()
|
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.monitor = None
|
||||||
self.clients = []
|
self.clients = []
|
||||||
self.spectrumClients = []
|
self.spectrumClients = []
|
||||||
|
@ -3,8 +3,8 @@ from .soapy import SoapyConnectorSource
|
|||||||
|
|
||||||
|
|
||||||
class AirspySource(SoapyConnectorSource):
|
class AirspySource(SoapyConnectorSource):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.getCommandMapper().setMappings({"bias_tee": Flag("-t biastee=true")})
|
self.getCommandMapper().setMappings({"bias_tee": Flag("-t biastee=true")})
|
||||||
|
|
||||||
def getDriver(self):
|
def getDriver(self):
|
||||||
|
@ -9,8 +9,8 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class ConnectorSource(SdrSource):
|
class ConnectorSource(SdrSource):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.controlSocket = None
|
self.controlSocket = None
|
||||||
self.controlPort = getAvailablePort()
|
self.controlPort = getAvailablePort()
|
||||||
self.getCommandMapper().setMappings(
|
self.getCommandMapper().setMappings(
|
||||||
|
@ -3,8 +3,8 @@ from .direct import DirectSource
|
|||||||
|
|
||||||
|
|
||||||
class FifiSdrSource(DirectSource):
|
class FifiSdrSource(DirectSource):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.getCommandMapper().setBase("arecord").setMappings(
|
self.getCommandMapper().setBase("arecord").setMappings(
|
||||||
{"device": Option("-D"), "samp_rate": Option("-r")}
|
{"device": Option("-D"), "samp_rate": Option("-r")}
|
||||||
).setStatic("-f S16_LE -c2 -")
|
).setStatic("-f S16_LE -c2 -")
|
||||||
|
@ -3,8 +3,8 @@ from owrx.command import Flag, Option
|
|||||||
|
|
||||||
|
|
||||||
class HackrfSource(DirectSource):
|
class HackrfSource(DirectSource):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.getCommandMapper().setBase("hackrf_transfer").setMappings(
|
self.getCommandMapper().setBase("hackrf_transfer").setMappings(
|
||||||
{
|
{
|
||||||
"samp_rate": Option("-s"),
|
"samp_rate": Option("-s"),
|
||||||
|
@ -15,7 +15,7 @@ class Resampler(DirectSource):
|
|||||||
def onPropertyChange(self, name, value):
|
def onPropertyChange(self, name, value):
|
||||||
logger.warning("Resampler is unable to handle property change ({0} changed to {1})".format(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()
|
sdrProps = sdr.getProps()
|
||||||
self.shift = (sdrProps["center_freq"] - props["center_freq"]) / sdrProps["samp_rate"]
|
self.shift = (sdrProps["center_freq"] - props["center_freq"]) / sdrProps["samp_rate"]
|
||||||
self.decimation = int(float(sdrProps["samp_rate"]) / props["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
|
props["samp_rate"] = if_samp_rate
|
||||||
|
|
||||||
self.sdr = sdr
|
self.sdr = sdr
|
||||||
super().__init__(None, props, port)
|
super().__init__(None, props)
|
||||||
|
|
||||||
def getCommand(self):
|
def getCommand(self):
|
||||||
return [
|
return [
|
||||||
|
@ -2,6 +2,6 @@ from .connector import ConnectorSource
|
|||||||
|
|
||||||
|
|
||||||
class RtlSdrSource(ConnectorSource):
|
class RtlSdrSource(ConnectorSource):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.getCommandMapper().setBase("rtl_connector")
|
self.getCommandMapper().setBase("rtl_connector")
|
||||||
|
@ -5,8 +5,8 @@ from .connector import ConnectorSource
|
|||||||
|
|
||||||
|
|
||||||
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
|
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
|
||||||
def __init__(self, id, props, port):
|
def __init__(self, id, props):
|
||||||
super().__init__(id, props, port)
|
super().__init__(id, props)
|
||||||
self.getCommandMapper().setBase("soapy_connector").setMappings({"antenna": Option("-a")})
|
self.getCommandMapper().setBase("soapy_connector").setMappings({"antenna": Option("-a")})
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user