Merge pull request #358 from jancona/multiple_hpsdr_radios
Allow configuration of HPSDR connector for multiple radios
This commit is contained in:
commit
643000e94d
|
|
@ -1,11 +1,10 @@
|
||||||
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
|
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
|
||||||
from owrx.command import Option
|
from owrx.command import Option, Flag
|
||||||
from owrx.form.error import ValidationError
|
from owrx.form.error import ValidationError
|
||||||
from owrx.form.input import Input, NumberInput, TextInput
|
from owrx.form.input import Input, NumberInput, TextInput, CheckboxInput
|
||||||
from owrx.form.input.validator import RangeValidator
|
from owrx.form.input.validator import RangeValidator
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
# 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:
|
||||||
# --frequency uint
|
# --frequency uint
|
||||||
# Tune to specified frequency in Hz (default 7100000)
|
# Tune to specified frequency in Hz (default 7100000)
|
||||||
|
|
@ -17,10 +16,17 @@ from typing import List
|
||||||
# Use the specified samplerate: one of 48000, 96000, 192000, 384000 (default 96000)
|
# Use the specified samplerate: one of 48000, 96000, 192000, 384000 (default 96000)
|
||||||
# --debug
|
# --debug
|
||||||
# Emit debug log messages on stdout
|
# Emit debug log messages on stdout
|
||||||
|
# --serverPort uint
|
||||||
|
# Server port for this radio (default 7300)
|
||||||
#
|
#
|
||||||
# If you omit `remote` from config_webrx.py, hpsdrconnector will use the HPSDR discovery protocol
|
# If a remote IP address is not set, the connector will use the HPSDR discovery protocol
|
||||||
# to find radios on your local network and will connect to the first radio it discovered.
|
# to find radios on the local network and will connect to the first radio it discovers.
|
||||||
|
# If there is more than one HPSDR radio on the network, the IP address of the desired radio
|
||||||
|
# should always be specified.
|
||||||
|
# To use multiple HPSDR radios, each radio should have its IP address and a unique server port
|
||||||
|
# specfied. For example:
|
||||||
|
# Radio 1: (Remote IP: 192.168.1.11, Server port: 7300)
|
||||||
|
# Radio 2: (Remote IP: 192.168.1.22, Server port: 7301)
|
||||||
|
|
||||||
class HpsdrSource(ConnectorSource):
|
class HpsdrSource(ConnectorSource):
|
||||||
def getCommandMapper(self):
|
def getCommandMapper(self):
|
||||||
|
|
@ -34,6 +40,8 @@ class HpsdrSource(ConnectorSource):
|
||||||
"samp_rate": Option("--samplerate"),
|
"samp_rate": Option("--samplerate"),
|
||||||
"remote": Option("--radio"),
|
"remote": Option("--radio"),
|
||||||
"rf_gain": Option("--gain"),
|
"rf_gain": Option("--gain"),
|
||||||
|
"server_port": Option("--serverPort"),
|
||||||
|
"debug": Flag("--debug"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -41,7 +49,12 @@ class HpsdrSource(ConnectorSource):
|
||||||
class RemoteInput(TextInput):
|
class RemoteInput(TextInput):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
"remote", "Remote IP", infotext="Remote IP address to connect to."
|
"remote",
|
||||||
|
"Remote IP",
|
||||||
|
infotext=(
|
||||||
|
"HPSDR radio IP address. If it is not set, the connector will connect to the first radio it discovers. "
|
||||||
|
"If there is more than one HPSDR radio on the network, IP addresses of the desired radios should always be specified."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
class HpsdrDeviceDescription(ConnectorDeviceDescription):
|
class HpsdrDeviceDescription(ConnectorDeviceDescription):
|
||||||
|
|
@ -51,11 +64,26 @@ class HpsdrDeviceDescription(ConnectorDeviceDescription):
|
||||||
def getInputs(self) -> List[Input]:
|
def getInputs(self) -> List[Input]:
|
||||||
return super().getInputs() + [
|
return super().getInputs() + [
|
||||||
RemoteInput(),
|
RemoteInput(),
|
||||||
NumberInput("rf_gain", "LNA Gain", "LNA gain between 0 (-12dB) and 60 (48dB)", validator=RangeValidator(0, 60)),
|
NumberInput(
|
||||||
|
"rf_gain",
|
||||||
|
"LNA Gain",
|
||||||
|
"LNA gain between 0 (-12dB) and 60 (48dB) (default 20)",
|
||||||
|
validator=RangeValidator(0, 60)
|
||||||
|
),
|
||||||
|
CheckboxInput(
|
||||||
|
"debug",
|
||||||
|
"Show connector debugging messages in the log"
|
||||||
|
),
|
||||||
|
NumberInput(
|
||||||
|
"server_port",
|
||||||
|
"Server port",
|
||||||
|
("Radio server port (default 7300). When using multiple radios, each must be on a separate port, "
|
||||||
|
"e.g. 7300 for the first, 7301 for the second.")
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
def getDeviceOptionalKeys(self):
|
def getDeviceOptionalKeys(self):
|
||||||
return list(filter(lambda x : x not in ["rtltcp_compat", "iqswap"], super().getDeviceOptionalKeys())) + ["remote"]
|
return list(filter(lambda x : x not in ["rtltcp_compat", "iqswap"], super().getDeviceOptionalKeys())) + ["remote","debug","server_port"]
|
||||||
|
|
||||||
def getProfileOptionalKeys(self):
|
def getProfileOptionalKeys(self):
|
||||||
return list(filter(lambda x : x != "iqswap", super().getProfileOptionalKeys()))
|
return list(filter(lambda x : x != "iqswap", super().getProfileOptionalKeys()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue