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):
|
2021-04-17 15:42:08 +00:00
|
|
|
def getName(self):
|
|
|
|
return "R&S device using EB200 or Ammos protocol"
|
|
|
|
|
2022-06-09 18:25:29 +00:00
|
|
|
def supportsPpm(self):
|
|
|
|
# currently not implemented in the connector
|
|
|
|
return False
|
|
|
|
|
2021-02-20 18:20:31 +00:00
|
|
|
def getInputs(self) -> List[Input]:
|
2021-02-21 23:35:47 +00:00
|
|
|
return super().getInputs() + [
|
|
|
|
RemoteInput(),
|
|
|
|
DropdownInput("protocol", "Protocol", ProtocolOptions),
|
2021-02-22 23:27:29 +00:00
|
|
|
CheckboxInput("long", "Use 32-bit sample size (LONG)"),
|
2021-02-21 23:35:47 +00:00
|
|
|
]
|
|
|
|
|
2021-03-24 22:17:50 +00:00
|
|
|
def getDeviceMandatoryKeys(self):
|
2021-04-02 19:44:51 +00:00
|
|
|
return super().getDeviceMandatoryKeys() + ["remote"]
|
2021-02-22 23:27:29 +00:00
|
|
|
|
2021-03-24 22:17:50 +00:00
|
|
|
def getDeviceOptionalKeys(self):
|
|
|
|
return super().getDeviceOptionalKeys() + ["protocol", "long"]
|