add direct sampling option, ref #37

This commit is contained in:
Jakob Ketterl 2020-01-10 20:50:56 +01:00
parent b7538dcdd0
commit 5a57648eec
2 changed files with 15 additions and 3 deletions

View File

@ -54,13 +54,18 @@ class Flag(CommandMapping):
class Option(CommandMapping):
def __init__(self, option):
self.option = option
self.spacer = " "
def map(self, value):
if value is not None:
if isinstance(value, str) and " " in value:
template = '{0} "{1}"'
template = '{option}{spacer}"{value}"'
else:
template = "{0} {1}"
return template.format(self.option, value)
template = "{option}{spacer}{value}"
return template.format(option=self.option, spacer=self.spacer, value=value)
else:
return ""
def setSpacer(self, spacer):
self.spacer = spacer
return self

View File

@ -1,6 +1,13 @@
from .soapy import SoapyConnectorSource
from owrx.command import Option
class RtlSdrSoapySource(SoapyConnectorSource):
def getCommandMapper(self):
return super().getCommandMapper().setMappings({"direct_sampling": Option("-t direct_samp").setSpacer("=")})
def getDriver(self):
return "rtlsdr"
def getEventNames(self):
return super().getEventNames() + ["direct_sampling"]