mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-01-04 07:40:10 +01:00
Allow configuration of HPSDR connector for multiple radios
This commit is contained in:
parent
d0611fa053
commit
21027f672c
|
|
@ -1,11 +1,10 @@
|
|||
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.input import Input, NumberInput, TextInput
|
||||
from owrx.form.input import Input, NumberInput, TextInput, CheckboxInput
|
||||
from owrx.form.input.validator import RangeValidator
|
||||
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:
|
||||
# --frequency uint
|
||||
# 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)
|
||||
# --debug
|
||||
# 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
|
||||
# to find radios on your local network and will connect to the first radio it discovered.
|
||||
|
||||
# If a remote IP address is not set, the connector will use the HPSDR discovery protocol
|
||||
# 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):
|
||||
def getCommandMapper(self):
|
||||
|
|
@ -34,6 +40,8 @@ class HpsdrSource(ConnectorSource):
|
|||
"samp_rate": Option("--samplerate"),
|
||||
"remote": Option("--radio"),
|
||||
"rf_gain": Option("--gain"),
|
||||
"server_port": Option("--serverPort"),
|
||||
"debug": Flag("--debug"),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
@ -41,7 +49,12 @@ class HpsdrSource(ConnectorSource):
|
|||
class RemoteInput(TextInput):
|
||||
def __init__(self):
|
||||
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):
|
||||
|
|
@ -51,11 +64,26 @@ class HpsdrDeviceDescription(ConnectorDeviceDescription):
|
|||
def getInputs(self) -> List[Input]:
|
||||
return super().getInputs() + [
|
||||
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):
|
||||
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):
|
||||
return list(filter(lambda x : x != "iqswap", super().getProfileOptionalKeys()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue