openwebrx-clone/owrx/source/rtl_sdr.py

38 lines
1.2 KiB
Python
Raw Normal View History

2021-02-19 14:29:17 +00:00
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
from owrx.command import Flag, Option
from typing import List
2021-04-29 13:17:21 +00:00
from owrx.form.input import Input, TextInput
from owrx.form.input.device import BiasTeeInput, DirectSamplingInput
class RtlSdrSource(ConnectorSource):
2019-12-31 18:14:05 +00:00
def getCommandMapper(self):
return (
super()
.getCommandMapper()
.setBase("rtl_connector")
.setMappings({"bias_tee": Flag("-b"), "direct_sampling": Option("-e")})
2020-03-26 12:33:32 +00:00
)
2021-02-19 14:29:17 +00:00
class RtlSdrDeviceDescription(ConnectorDeviceDescription):
def getName(self):
return "RTL-SDR device"
def getInputs(self) -> List[Input]:
return super().getInputs() + [
TextInput(
"device",
"Device identifier",
infotext="Device serial number or index",
),
BiasTeeInput(),
DirectSamplingInput(),
]
def getDeviceOptionalKeys(self):
return super().getDeviceOptionalKeys() + ["device", "bias_tee", "direct_sampling"]
2021-02-23 17:32:23 +00:00
def getProfileOptionalKeys(self):
return super().getProfileOptionalKeys() + ["bias_tee", "direct_sampling"]