openwebrx-clone/owrx/source/runds.py

59 lines
1.7 KiB
Python
Raw Permalink Normal View History

2021-02-20 17:09:24 +00:00
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
2021-02-03 02:21:09 +00:00
from owrx.command import Argument, Flag, Option
2021-04-29 13:17:21 +00:00
from owrx.form.input import Input, DropdownInput, DropdownEnum, CheckboxInput
from owrx.form.input.device import RemoteInput
2021-02-20 18:20:31 +00:00
from typing import List
2020-11-29 23:34:44 +00:00
2021-02-03 02:21:09 +00:00
class RundsSource(ConnectorSource):
2020-11-29 23:34:44 +00:00
def getCommandMapper(self):
return (
super()
.getCommandMapper()
2021-02-03 02:21:09 +00:00
.setBase("runds_connector")
2021-01-20 16:01:46 +00:00
.setMappings(
{
"long": Flag("-l"),
"remote": Argument(),
2021-02-03 02:21:09 +00:00
"protocol": Option("-m"),
2021-01-20 16:01:46 +00:00
}
)
2020-11-29 23:34:44 +00:00
)
2021-02-20 17:09:24 +00:00
2021-02-20 18:20:31 +00:00
class ProtocolOptions(DropdownEnum):
PROTOCOL_EB200 = ("eb200", "EB200 protocol")
PROTOCOL_AMMOS = ("ammos", "Ammos protocol")
def __new__(cls, *args, **kwargs):
value, description = args
obj = object.__new__(cls)
obj._value_ = value
obj.description = description
return obj
def __str__(self):
return self.description
2021-02-20 17:09:24 +00:00
class RundsDeviceDescription(ConnectorDeviceDescription):
def getName(self):
return "R&S device using EB200 or Ammos protocol"
def supportsPpm(self):
# currently not implemented in the connector
return False
2021-02-20 18:20:31 +00:00
def getInputs(self) -> List[Input]:
return super().getInputs() + [
RemoteInput(),
DropdownInput("protocol", "Protocol", ProtocolOptions),
CheckboxInput("long", "Use 32-bit sample size (LONG)"),
]
def getDeviceMandatoryKeys(self):
2021-04-02 19:44:51 +00:00
return super().getDeviceMandatoryKeys() + ["remote"]
def getDeviceOptionalKeys(self):
return super().getDeviceOptionalKeys() + ["protocol", "long"]