openwebrx-clone/owrx/source/rtl_sdr.py

34 lines
1.0 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
from owrx.form import Input, TextInput
2021-02-19 17:45:29 +00:00
from owrx.form.converter import OptionalConverter
from owrx.form.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 getInputs(self) -> List[Input]:
2021-02-19 13:53:30 +00:00
return self.mergeInputs(
super().getInputs(),
[
2021-02-19 17:45:29 +00:00
TextInput(
"device",
"Device identifier",
infotext="Device serial number or index",
converter=OptionalConverter(),
),
BiasTeeInput(),
DirectSamplingInput()
2021-02-19 13:53:30 +00:00
],
)