Merge branch 'develop' into pycsdr

This commit is contained in:
Jakob Ketterl
2021-01-23 17:17:44 +01:00
50 changed files with 524 additions and 368 deletions

View File

@ -86,17 +86,17 @@ class SdrSource(ABC):
for id, p in self.props["profiles"].items():
props.replaceLayer(0, self._getProfilePropertyLayer(p))
if "center_freq" not in props:
logger.warning("Profile \"%s\" does not specify a center_freq", id)
logger.warning('Profile "%s" does not specify a center_freq', id)
continue
if "samp_rate" not in props:
logger.warning("Profile \"%s\" does not specify a samp_rate", id)
logger.warning('Profile "%s" does not specify a samp_rate', id)
continue
if "start_freq" in props:
start_freq = props["start_freq"]
srh = props["samp_rate"] / 2
center_freq = props["center_freq"]
if start_freq < center_freq - srh or start_freq > center_freq + srh:
logger.warning("start_freq for profile \"%s\" is out of range", id)
logger.warning('start_freq for profile "%s" is out of range', id)
def _getProfilePropertyLayer(self, profile):
layer = PropertyLayer()

View File

@ -15,18 +15,22 @@ class ConnectorSource(SdrSource):
super().__init__(id, props)
def getCommandMapper(self):
return super().getCommandMapper().setMappings(
{
"samp_rate": Option("-s"),
"tuner_freq": Option("-f"),
"port": Option("-p"),
"controlPort": Option("-c"),
"device": Option("-d"),
"iqswap": Flag("-i"),
"rtltcp_compat": Option("-r"),
"ppm": Option("-P"),
"rf_gain": Option("-g"),
}
return (
super()
.getCommandMapper()
.setMappings(
{
"samp_rate": Option("-s"),
"tuner_freq": Option("-f"),
"port": Option("-p"),
"controlPort": Option("-c"),
"device": Option("-d"),
"iqswap": Flag("-i"),
"rtltcp_compat": Option("-r"),
"ppm": Option("-P"),
"rf_gain": Option("-g"),
}
)
)
def sendControlMessage(self, changes):

View File

@ -32,11 +32,14 @@ class DirectSource(SdrSource, metaclass=ABCMeta):
"These depend on nmux_memory and samp_rate options in config_webrx.py"
)
return ["nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (
nmux_bufsize,
nmux_bufcnt,
self.port,
)]
return [
"nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1"
% (
nmux_bufsize,
nmux_bufcnt,
self.port,
)
]
def getCommand(self):
return super().getCommand() + self.getFormatConversion() + self.getNmuxCommand()

View File

@ -8,8 +8,10 @@ class Eb200Source(ConnectorSource):
super()
.getCommandMapper()
.setBase("eb200_connector")
.setMappings({
"long": Flag("-l"),
"remote": Argument(),
})
.setMappings(
{
"long": Flag("-l"),
"remote": Argument(),
}
)
)

View File

@ -9,9 +9,13 @@ logger = logging.getLogger(__name__)
class FifiSdrSource(DirectSource):
def getCommandMapper(self):
return super().getCommandMapper().setBase("arecord").setMappings(
{"device": Option("-D"), "samp_rate": Option("-r")}
).setStatic("-t raw -f S16_LE -c2 -")
return (
super()
.getCommandMapper()
.setBase("arecord")
.setMappings({"device": Option("-D"), "samp_rate": Option("-r")})
.setStatic("-t raw -f S16_LE -c2 -")
)
def getEventNames(self):
return super().getEventNames() + ["device"]
@ -20,7 +24,7 @@ class FifiSdrSource(DirectSource):
return ["csdr convert_s16_f", "csdr gain_ff 5"]
def sendRockProgFrequency(self, frequency):
process = Popen(["rockprog", "--vco", "-w", "--freq={}".format(frequency / 1E6)])
process = Popen(["rockprog", "--vco", "-w", "--freq={}".format(frequency / 1e6)])
process.communicate()
rc = process.wait()
if rc != 0:

View File

@ -8,4 +8,4 @@ class HackrfSource(SoapyConnectorSource):
return mappings
def getDriver(self):
return "hackrf"
return "hackrf"

View File

@ -17,6 +17,7 @@ from owrx.command import Flag, Option
# If you omit `remote` from config_webrx.py, hpsdrconnector will use the HPSDR discovery protocol
# to find radios on your local network and will connect to the first radio it discovered.
class HpsdrSource(ConnectorSource):
def getCommandMapper(self):
return (
@ -24,10 +25,11 @@ class HpsdrSource(ConnectorSource):
.getCommandMapper()
.setBase("hpsdrconnector")
.setMappings(
{
"tuner_freq": Option("--frequency"),
"samp_rate": Option("--samplerate"),
"remote": Option("--radio"),
"rf_gain": Option("--gain"),
})
{
"tuner_freq": Option("--frequency"),
"samp_rate": Option("--samplerate"),
"remote": Option("--radio"),
"rf_gain": Option("--gain"),
}
)
)

View File

@ -17,15 +17,21 @@ from owrx.command import Flag, Option
# floating points (option -p),no need for further conversions,
# so the method getFormatConversion(self) is not implemented at all.
class PerseussdrSource(DirectSource):
def getCommandMapper(self):
return super().getCommandMapper().setBase("perseustest -p -d -1 -a -t 0 -o - ").setMappings(
{
"samp_rate": Option("-s"),
"tuner_freq": Option("-f"),
"attenuator": Option("-u"),
"adc_preamp": Option("-m"),
"adc_dither": Option("-x"),
"wideband": Option("-w"),
}
return (
super()
.getCommandMapper()
.setBase("perseustest -p -d -1 -a -t 0 -o - ")
.setMappings(
{
"samp_rate": Option("-s"),
"tuner_freq": Option("-f"),
"attenuator": Option("-u"),
"adc_preamp": Option("-m"),
"adc_dither": Option("-x"),
"wideband": Option("-w"),
}
)
)

View File

@ -8,9 +8,11 @@ class RtlTcpSource(ConnectorSource):
super()
.getCommandMapper()
.setBase("rtl_tcp_connector")
.setMappings({
"bias_tee": Flag("-b"),
"direct_sampling": Option("-e"),
"remote": Argument(),
})
.setMappings(
{
"bias_tee": Flag("-b"),
"direct_sampling": Option("-e"),
"remote": Argument(),
}
)
)

View File

@ -5,11 +5,16 @@ from .connector import ConnectorSource
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
def getCommandMapper(self):
return super().getCommandMapper().setBase("soapy_connector").setMappings(
{
"antenna": Option("-a"),
"soapy_settings": Option("-t"),
}
return (
super()
.getCommandMapper()
.setBase("soapy_connector")
.setMappings(
{
"antenna": Option("-a"),
"soapy_settings": Option("-t"),
}
)
)
"""