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