Set proper config options for HPSDR connector

This commit is contained in:
Jim Ancona 2021-05-10 20:35:49 -04:00
parent a006d8c125
commit e37bc0573d

View File

@ -1,5 +1,7 @@
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
from owrx.command import Option from owrx.command import Option
from owrx.form.input import Input, NumberInput, TextInput
from typing import List
# In order to use an HPSDR radio, you must install hpsdrconnector from https://github.com/jancona/hpsdrconnector # In order to use an HPSDR radio, you must install hpsdrconnector from https://github.com/jancona/hpsdrconnector
# These are the command line options available: # These are the command line options available:
@ -34,7 +36,25 @@ class HpsdrSource(ConnectorSource):
) )
) )
class RemoteInput(TextInput):
def __init__(self):
super().__init__(
"remote", "Remote IP", infotext="Remote IP address to connect to."
)
class HpsdrDeviceDescription(ConnectorDeviceDescription): class HpsdrDeviceDescription(ConnectorDeviceDescription):
def getName(self): def getName(self):
return "HPSDR devices (Hermes / Hermes Lite 2 / Red Pitaya)" return "HPSDR devices (Hermes / Hermes Lite 2 / Red Pitaya)"
def getInputs(self) -> List[Input]:
return list(filter(lambda x : x.id != "rf_gain", super().getInputs())) + [
RemoteInput(), NumberInput("rf_gain", "LNA Gain",
"LNA gain between 0 (-12dB) and 60 (48dB)"),
]
def getDeviceOptionalKeys(self):
return list(filter(lambda x : x not in ["rtltcp_compat", "iqswap"], super().getDeviceOptionalKeys())) + ["remote"]
def getProfileOptionalKeys(self):
return list(filter(lambda x : x != "iqswap", super().getProfileOptionalKeys()))