mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Add basic remote device sample rate range checking.
Add IP address history. Add SDRPlay LNA gain support.
This commit is contained in:
parent
a0c75f0407
commit
d76521ef9a
@ -266,6 +266,23 @@ bool RemoteTCPInputGui::handleMessage(const Message& message)
|
||||
ui->centerFrequency->setValueRange(7, 0, 9999999);
|
||||
}
|
||||
|
||||
// Set sample rate range
|
||||
if (m_sampleRateRanges.contains(m_remoteDevice))
|
||||
{
|
||||
const SampleRateRange *range = m_sampleRateRanges.value(m_remoteDevice);
|
||||
ui->devSampleRate->setValueRange(8, range->m_min, range->m_max);
|
||||
}
|
||||
else if (m_sampleRateLists.contains(m_remoteDevice))
|
||||
{
|
||||
const QList<int> *list = m_sampleRateLists.value(m_remoteDevice);
|
||||
// FIXME: Should probably use a combobox for devices that have a list of sample rates
|
||||
ui->devSampleRate->setValueRange(8, list->front(), list->back());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->devSampleRate->setValueRange(8, 0, 99999999);
|
||||
}
|
||||
|
||||
displayGains();
|
||||
return true;
|
||||
}
|
||||
@ -352,7 +369,16 @@ void RemoteTCPInputGui::displaySettings()
|
||||
ui->sampleBits->setCurrentIndex(m_settings.m_sampleBits/8-1);
|
||||
|
||||
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
||||
ui->dataAddress->setText(m_settings.m_dataAddress);
|
||||
ui->dataAddress->blockSignals(true);
|
||||
ui->dataAddress->clear();
|
||||
for (const auto& address : m_settings.m_addressList) {
|
||||
ui->dataAddress->addItem(address);
|
||||
}
|
||||
if (ui->dataAddress->findText(m_settings.m_dataAddress) == -1) {
|
||||
ui->dataAddress->addItem(m_settings.m_dataAddress);
|
||||
}
|
||||
ui->dataAddress->setCurrentText(m_settings.m_dataAddress);
|
||||
ui->dataAddress->blockSignals(false);
|
||||
ui->overrideRemoteSettings->setChecked(m_settings.m_overrideRemoteSettings);
|
||||
|
||||
ui->preFill->setValue((int)(m_settings.m_preFill * 10.0));
|
||||
@ -362,6 +388,43 @@ void RemoteTCPInputGui::displaySettings()
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
// Device sample rates
|
||||
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_rtlSDRSampleRateRange{900001, 3200000};
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_sdrPlaySampleRateRange{2000000, 10660000};
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_bladeRF1SampleRateRange{330000, 40000000};
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_hackRFSampleRateRange{1000000, 20000000};
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_limeSampleRateRange{100000, 614400000}; // Mini is lower than this
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_plutoSampleRateRange{2000000, 20000000};
|
||||
const RemoteTCPInputGui::SampleRateRange RemoteTCPInputGui::m_usrpSampleRateRange{100000, 614400000}; // For B210
|
||||
|
||||
const QHash<RemoteTCPProtocol::Device, const RemoteTCPInputGui::SampleRateRange *> RemoteTCPInputGui::m_sampleRateRanges =
|
||||
{
|
||||
{RemoteTCPProtocol::RTLSDR_E4000, &m_rtlSDRSampleRateRange},
|
||||
{RemoteTCPProtocol::RTLSDR_R820T, &m_rtlSDRSampleRateRange},
|
||||
{RemoteTCPProtocol::BLADE_RF1, &m_bladeRF1SampleRateRange},
|
||||
{RemoteTCPProtocol::HACK_RF, &m_hackRFSampleRateRange},
|
||||
{RemoteTCPProtocol::LIME_SDR, &m_limeSampleRateRange},
|
||||
{RemoteTCPProtocol::SDRPLAY_V3_RSP1, &m_sdrPlaySampleRateRange},
|
||||
{RemoteTCPProtocol::SDRPLAY_V3_RSP1A, &m_sdrPlaySampleRateRange},
|
||||
{RemoteTCPProtocol::SDRPLAY_V3_RSP2, &m_sdrPlaySampleRateRange},
|
||||
{RemoteTCPProtocol::SDRPLAY_V3_RSPDUO, &m_sdrPlaySampleRateRange},
|
||||
{RemoteTCPProtocol::SDRPLAY_V3_RSPDX, &m_sdrPlaySampleRateRange},
|
||||
{RemoteTCPProtocol::PLUTO_SDR, &m_plutoSampleRateRange},
|
||||
{RemoteTCPProtocol::USRP, &m_usrpSampleRateRange},
|
||||
};
|
||||
|
||||
const QList<int> RemoteTCPInputGui::m_airspySampleRateList {2500000, 10000000};
|
||||
const QList<int> RemoteTCPInputGui::m_airspyHFSampleRateList {192000, 256000, 384000, 456000, 768000, 912000};
|
||||
|
||||
const QHash<RemoteTCPProtocol::Device, const QList<int> *> RemoteTCPInputGui::m_sampleRateLists =
|
||||
{
|
||||
{RemoteTCPProtocol::AIRSPY, &m_airspySampleRateList},
|
||||
{RemoteTCPProtocol::AIRSPY_HF, &m_airspyHFSampleRateList}
|
||||
};
|
||||
|
||||
// Device gains
|
||||
|
||||
const RemoteTCPInputGui::DeviceGains::GainRange RemoteTCPInputGui::m_rtlSDR34kGainRange(
|
||||
"Gain",
|
||||
{
|
||||
@ -408,8 +471,8 @@ const RemoteTCPInputGui::DeviceGains RemoteTCPInputGui::m_kiwiGains({m_kiwiGainR
|
||||
const RemoteTCPInputGui::DeviceGains::GainRange RemoteTCPInputGui::m_limeRange("Gain", 0, 70, 1); // Assuming auto setting
|
||||
const RemoteTCPInputGui::DeviceGains RemoteTCPInputGui::m_limeGains({m_limeRange}, true, false);
|
||||
|
||||
// SDRplay LNA gain is device & frequency dependent (See sdrplayv3input.h SDRPlayV3LNA) sp we just fix as 0 for now
|
||||
const RemoteTCPInputGui::DeviceGains::GainRange RemoteTCPInputGui::m_sdrplayV3LNAGainRange("LNA", {0});
|
||||
// SDRplay LNA gain is device & frequency dependent (See sdrplayv3input.h SDRPlayV3LNA), server should choose closest value
|
||||
const RemoteTCPInputGui::DeviceGains::GainRange RemoteTCPInputGui::m_sdrplayV3LNAGainRange("LNA", -80, 0, 1);
|
||||
const RemoteTCPInputGui::DeviceGains::GainRange RemoteTCPInputGui::m_sdrplayV3IFGainRange("IF", -59, 0, 1);
|
||||
const RemoteTCPInputGui::DeviceGains RemoteTCPInputGui::m_sdrplayV3Gains({m_sdrplayV3LNAGainRange, m_sdrplayV3IFGainRange}, true, true);
|
||||
|
||||
@ -691,7 +754,21 @@ void RemoteTCPInputGui::on_sampleBits_currentIndexChanged(int index)
|
||||
|
||||
void RemoteTCPInputGui::on_dataAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||
m_settings.m_dataAddress = ui->dataAddress->currentText();
|
||||
m_settingsKeys.append("dataAddress");
|
||||
m_settings.m_addressList.clear();
|
||||
for (int i = 0; i < ui->dataAddress->count(); i++) {
|
||||
m_settings.m_addressList.append(ui->dataAddress->itemText(i));
|
||||
}
|
||||
m_settingsKeys.append("addressList");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void RemoteTCPInputGui::on_dataAddress_currentIndexChanged(int index)
|
||||
{
|
||||
(void) index;
|
||||
|
||||
m_settings.m_dataAddress = ui->dataAddress->currentText();
|
||||
m_settingsKeys.append("dataAddress");
|
||||
sendSettings();
|
||||
}
|
||||
@ -816,7 +893,8 @@ void RemoteTCPInputGui::makeUIConnections()
|
||||
QObject::connect(ui->channelSampleRate, &ValueDial::changed, this, &RemoteTCPInputGui::on_channelSampleRate_changed);
|
||||
QObject::connect(ui->decimation, &ButtonSwitch::toggled, this, &RemoteTCPInputGui::on_decimation_toggled);
|
||||
QObject::connect(ui->sampleBits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteTCPInputGui::on_sampleBits_currentIndexChanged);
|
||||
QObject::connect(ui->dataAddress, &QLineEdit::editingFinished, this, &RemoteTCPInputGui::on_dataAddress_editingFinished);
|
||||
QObject::connect(ui->dataAddress->lineEdit(), &QLineEdit::editingFinished, this, &RemoteTCPInputGui::on_dataAddress_editingFinished);
|
||||
QObject::connect(ui->dataAddress, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteTCPInputGui::on_dataAddress_currentIndexChanged);
|
||||
QObject::connect(ui->dataPort, &QLineEdit::editingFinished, this, &RemoteTCPInputGui::on_dataPort_editingFinished);
|
||||
QObject::connect(ui->overrideRemoteSettings, &ButtonSwitch::toggled, this, &RemoteTCPInputGui::on_overrideRemoteSettings_toggled);
|
||||
QObject::connect(ui->preFill, &QDial::valueChanged, this, &RemoteTCPInputGui::on_preFill_valueChanged);
|
||||
|
@ -86,6 +86,11 @@ class RemoteTCPInputGui : public DeviceGUI {
|
||||
bool m_biasTee;
|
||||
};
|
||||
|
||||
struct SampleRateRange {
|
||||
int m_min;
|
||||
int m_max;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit RemoteTCPInputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
||||
virtual ~RemoteTCPInputGui();
|
||||
@ -151,6 +156,19 @@ private:
|
||||
static const DeviceGains m_xtrxGains;
|
||||
static const QHash<RemoteTCPProtocol::Device, const DeviceGains *> m_gains;
|
||||
|
||||
static const SampleRateRange m_rtlSDRSampleRateRange;
|
||||
static const SampleRateRange m_sdrPlaySampleRateRange;
|
||||
static const SampleRateRange m_bladeRF1SampleRateRange;
|
||||
static const SampleRateRange m_hackRFSampleRateRange;
|
||||
static const SampleRateRange m_limeSampleRateRange;
|
||||
static const SampleRateRange m_plutoSampleRateRange;
|
||||
static const SampleRateRange m_usrpSampleRateRange;
|
||||
static const QHash<RemoteTCPProtocol::Device, const SampleRateRange *> m_sampleRateRanges;
|
||||
|
||||
static const QList<int> m_airspySampleRateList;
|
||||
static const QList<int> m_airspyHFSampleRateList;
|
||||
static const QHash<RemoteTCPProtocol::Device, const QList<int> *> m_sampleRateLists;
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void displaySettings();
|
||||
QString gainText(int stage);
|
||||
@ -186,6 +204,7 @@ private slots:
|
||||
void on_decimation_toggled(bool checked);
|
||||
void on_sampleBits_currentIndexChanged(int index);
|
||||
void on_dataAddress_editingFinished();
|
||||
void on_dataAddress_currentIndexChanged(int index);
|
||||
void on_dataPort_editingFinished();
|
||||
void on_overrideRemoteSettings_toggled(bool checked);
|
||||
void on_preFill_valueChanged(int value);
|
||||
|
@ -876,7 +876,7 @@ Use to ensure full dynamic range of 8-bit data is used.</string>
|
||||
<widget class="QLabel" name="dataAddressLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -886,28 +886,24 @@ Use to ensure full dynamic range of 8-bit data is used.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dataAddress">
|
||||
<widget class="QComboBox" name="dataAddress">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remote IPv4 address or hostname to connect to</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1184,17 +1180,17 @@ This should typically be empty. If full, your CPU cannot keep up and data will b
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>startStop</tabstop>
|
||||
@ -1213,7 +1209,6 @@ This should typically be empty. If full, your CPU cannot keep up and data will b
|
||||
<tabstop>channelGain</tabstop>
|
||||
<tabstop>decimation</tabstop>
|
||||
<tabstop>sampleBits</tabstop>
|
||||
<tabstop>dataAddress</tabstop>
|
||||
<tabstop>dataPort</tabstop>
|
||||
<tabstop>overrideRemoteSettings</tabstop>
|
||||
<tabstop>preFill</tabstop>
|
||||
|
@ -80,6 +80,7 @@ QByteArray RemoteTCPInputSettings::serialize() const
|
||||
s.writeString(21, m_reverseAPIAddress);
|
||||
s.writeU32(22, m_reverseAPIPort);
|
||||
s.writeU32(23, m_reverseAPIDeviceIndex);
|
||||
s.writeList(24, m_addressList);
|
||||
|
||||
for (int i = 0; i < m_maxGains; i++) {
|
||||
s.writeS32(30+i, m_gain[i]);
|
||||
@ -134,6 +135,8 @@ bool RemoteTCPInputSettings::deserialize(const QByteArray& data)
|
||||
d.readU32(23, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
|
||||
d.readList(24, &m_addressList);
|
||||
|
||||
for (int i = 0; i < m_maxGains; i++) {
|
||||
d.readS32(30+i, &m_gain[i], 0);
|
||||
}
|
||||
@ -218,6 +221,9 @@ void RemoteTCPInputSettings::applySettings(const QStringList& settingsKeys, cons
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("addressList")) {
|
||||
m_addressList = settings.m_addressList;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_maxGains; i++)
|
||||
{
|
||||
@ -300,6 +306,9 @@ QString RemoteTCPInputSettings::getDebugString(const QStringList& settingsKeys,
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("addressList") || force) {
|
||||
ostr << " m_addressList: " << m_addressList.join(",").toStdString();
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_maxGains; i++)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ struct RemoteTCPInputSettings
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
QStringList m_addressList; // List of dataAddresses that have been used in the past
|
||||
|
||||
RemoteTCPInputSettings();
|
||||
void resetToDefaults();
|
||||
|
@ -495,11 +495,6 @@ void RemoteTCPInputTCPHandler::connected()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
qDebug() << "RemoteTCPInputTCPHandler::connected";
|
||||
if (m_settings.m_overrideRemoteSettings)
|
||||
{
|
||||
// Force settings to be sent to remote device
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
if (m_messageQueueToGUI)
|
||||
{
|
||||
MsgReportConnection *msg = MsgReportConnection::create(true);
|
||||
@ -649,6 +644,11 @@ void RemoteTCPInputTCPHandler::dataReadyRead()
|
||||
{
|
||||
qDebug() << "RemoteTCPInputTCPHandler::dataReadyRead: Unknown protocol: " << protocol;
|
||||
}
|
||||
if (m_settings.m_overrideRemoteSettings)
|
||||
{
|
||||
// Force settings to be sent to remote device (this needs to be after m_sdra is determined above)
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
}
|
||||
m_readMetaData = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user