add more inputs, bind to actual data

This commit is contained in:
Jakob Ketterl
2021-02-19 18:18:25 +01:00
parent 27c16c3720
commit 039b57d28b
10 changed files with 76 additions and 19 deletions

View File

@ -10,7 +10,8 @@ from abc import ABC, abstractmethod
from owrx.command import CommandMapper
from owrx.socket import getAvailablePort
from owrx.property import PropertyStack, PropertyLayer
from owrx.form import Input, TextInput, NumberInput, CheckboxInput
from owrx.form import Input, TextInput, NumberInput, CheckboxInput, FloatInput
from owrx.form.converter import IntConverter, OptionalConverter
from owrx.controllers.settings import Section
from typing import List
@ -375,14 +376,25 @@ class SdrDeviceDescription(object):
def getInputs(self) -> List[Input]:
return [
TextInput("name", "Device name"),
NumberInput("ppm", "Frequency correction", append="ppm"),
NumberInput(
"ppm",
"Frequency correction",
append="ppm",
converter=OptionalConverter(IntConverter(), defaultFormValue="0"),
),
CheckboxInput(
"always-on",
"",
checkboxText="Keep device running at all times",
infotext="Prevents shutdown of the device when idle. Useful for devices with unreliable startup."
infotext="Prevents shutdown of the device when idle. Useful for devices with unreliable startup.",
),
CheckboxInput("services", "", "Run services on this device"),
CheckboxInput(
"services",
"",
"Run background services on this device",
converter=OptionalConverter(defaultFormValue=True),
),
FloatInput("rf_gain", "Device gain"),
]
def mergeInputs(self, *args):

View File

@ -4,6 +4,7 @@ import socket
from owrx.command import Flag, Option
from typing import List
from owrx.form import Input, NumberInput
from owrx.form.converter import OptionalConverter, IntConverter
import logging
@ -84,6 +85,7 @@ class ConnectorDeviceDescription(SdrDeviceDescription):
infotext="Activate an rtl_tcp compatible interface on the port number specified.<br />"
+ "Note: Port is only available on the local machine, not on the network.<br />"
+ "Note: IQ data may be degraded by the downsampling process to 8 bits.",
converter=OptionalConverter(IntConverter()),
)
],
)

View File

@ -20,4 +20,5 @@ class SdrplaySource(SoapyConnectorSource):
class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
pass
def getGainStages(self):
return ["RFGR", "IFGR"]

View File

@ -3,6 +3,7 @@ from owrx.command import Option
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
from typing import List
from owrx.form import Input, TextInput
from owrx.form.soapy import SoapyGainInput
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
@ -108,5 +109,13 @@ class SoapyConnectorDeviceDescription(ConnectorDeviceDescription):
"Device Identifier",
infotext='SoapySDR device identifier string (example: "serial=123456789")',
),
SoapyGainInput(
"rf_gain",
"Device Gain",
gain_stages=self.getGainStages(),
),
],
)
def getGainStages(self):
return []