mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
commit
f6ea6f8a2e
@ -290,13 +290,13 @@ void M17Demod::applySettings(const M17DemodSettings& settings, const QList<QStri
|
||||
m_basebandSink->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
if (settingsKeys.contains("m_useReverseAPI"))
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIDeviceIndex") ||
|
||||
settingsKeys.contains("reverseAPIChannelIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
|
@ -344,6 +344,7 @@ void M17DemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
(void) rollDown;
|
||||
|
||||
getRollupContents()->saveState(m_rollupState);
|
||||
applySettings({"rollupState"});
|
||||
}
|
||||
|
||||
void M17DemodGUI::onMenuDialogCalled(const QPoint &p)
|
||||
|
@ -170,7 +170,11 @@ void LocalSinkBaseband::applySettings(const LocalSinkSettings& settings, const Q
|
||||
}
|
||||
|
||||
m_sink.applySettings(settings, settingsKeys, force);
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
int LocalSinkBaseband::getChannelSampleRate() const
|
||||
|
@ -30,7 +30,7 @@ Specifies number of bits per I/Q sample transmitted via TCP/IP.
|
||||
|
||||
<h3>5: IP address</h3>
|
||||
|
||||
IP address of the local network interface on which the server will listen for TCP/IP connections from network clients.
|
||||
IP address of the local network interface on which the server will listen for TCP/IP connections from network clients. Use 0.0.0.0 for any interface.
|
||||
|
||||
<h3>6: Port</h3>
|
||||
|
||||
|
@ -56,7 +56,7 @@ RemoteTCPSink::RemoteTCPSink(DeviceAPI *deviceAPI) :
|
||||
m_basebandSink->setMessageQueueToChannel(&m_inputMessageQueue);
|
||||
m_basebandSink->moveToThread(&m_thread);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QStringList(), true);
|
||||
|
||||
m_deviceAPI->addChannelSink(this);
|
||||
m_deviceAPI->addChannelSinkAPI(this);
|
||||
@ -147,7 +147,7 @@ bool RemoteTCPSink::handleMessage(const Message& cmd)
|
||||
{
|
||||
MsgConfigureRemoteTCPSink& cfg = (MsgConfigureRemoteTCPSink&) cmd;
|
||||
qDebug() << "RemoteTCPSink::handleMessage: MsgConfigureRemoteTCPSink";
|
||||
applySettings(cfg.getSettings(), cfg.getForce(), cfg.getRemoteChange());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce(), cfg.getRemoteChange());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -183,14 +183,14 @@ bool RemoteTCPSink::deserialize(const QByteArray& data)
|
||||
(void) data;
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(m_settings, true);
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(m_settings, QStringList(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(m_settings, true);
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(m_settings, QStringList(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return false;
|
||||
}
|
||||
@ -200,18 +200,19 @@ void RemoteTCPSink::setCenterFrequency(qint64 frequency)
|
||||
{
|
||||
RemoteTCPSinkSettings settings = m_settings;
|
||||
settings.m_inputFrequencyOffset = frequency;
|
||||
applySettings(settings, false);
|
||||
applySettings(settings, {"inputFrequencyOffset"}, false);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRemoteTCPSink *msgToGUI = MsgConfigureRemoteTCPSink::create(settings, false);
|
||||
MsgConfigureRemoteTCPSink *msgToGUI = MsgConfigureRemoteTCPSink::create(settings, {"inputFrequencyOffset"}, false);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteTCPSink::applySettings(const RemoteTCPSinkSettings& settings, bool force, bool remoteChange)
|
||||
void RemoteTCPSink::applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force, bool remoteChange)
|
||||
{
|
||||
qDebug() << "RemoteTCPSink::applySettings:"
|
||||
<< " settingsKeys: " << settingsKeys
|
||||
<< " m_channelSampleRate: " << settings.m_channelSampleRate
|
||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||
<< " m_gain: " << settings.m_gain
|
||||
@ -223,37 +224,7 @@ void RemoteTCPSink::applySettings(const RemoteTCPSinkSettings& settings, bool fo
|
||||
<< " force: " << force
|
||||
<< " remoteChange: " << remoteChange;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((m_settings.m_channelSampleRate != settings.m_channelSampleRate) || force) {
|
||||
reverseAPIKeys.append("m_channelSampleRate");
|
||||
}
|
||||
if ((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force) {
|
||||
reverseAPIKeys.append("inputFrequencyOffset");
|
||||
}
|
||||
if ((m_settings.m_gain != settings.m_gain) || force) {
|
||||
reverseAPIKeys.append("gain");
|
||||
}
|
||||
if ((m_settings.m_sampleBits != settings.m_sampleBits) || force) {
|
||||
reverseAPIKeys.append("sampleBits");
|
||||
}
|
||||
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) {
|
||||
reverseAPIKeys.append("dataAddress");
|
||||
}
|
||||
if ((m_settings.m_dataPort != settings.m_dataPort) || force) {
|
||||
reverseAPIKeys.append("dataPort");
|
||||
}
|
||||
if ((m_settings.m_protocol != settings.m_protocol) || force) {
|
||||
reverseAPIKeys.append("protocol");
|
||||
}
|
||||
if ((m_settings.m_rgbColor != settings.m_rgbColor) || force) {
|
||||
reverseAPIKeys.append("rgbColor");
|
||||
}
|
||||
if ((m_settings.m_title != settings.m_title) || force) {
|
||||
reverseAPIKeys.append("title");
|
||||
}
|
||||
|
||||
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
||||
if (settingsKeys.contains("streamIndex"))
|
||||
{
|
||||
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
||||
{
|
||||
@ -262,31 +233,33 @@ void RemoteTCPSink::applySettings(const RemoteTCPSinkSettings& settings, bool fo
|
||||
m_deviceAPI->addChannelSink(this, settings.m_streamIndex);
|
||||
m_deviceAPI->addChannelSinkAPI(this);
|
||||
}
|
||||
|
||||
reverseAPIKeys.append("streamIndex");
|
||||
}
|
||||
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(settings, force, remoteChange);
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(settings, settingsKeys, force, remoteChange);
|
||||
m_basebandSink->getInputMessageQueue()->push(msg);
|
||||
|
||||
if ((settings.m_useReverseAPI) && (reverseAPIKeys.size() != 0))
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIDeviceIndex") ||
|
||||
settingsKeys.contains("reverseAPIChannelIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
QList<ObjectPipe*> pipes;
|
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||
|
||||
if (pipes.size() > 0) {
|
||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||
sendChannelSettings(pipes, settingsKeys, settings, force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
int RemoteTCPSink::webapiSettingsGet(
|
||||
@ -319,14 +292,14 @@ int RemoteTCPSink::webapiSettingsPutPatch(
|
||||
RemoteTCPSinkSettings settings = m_settings;
|
||||
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
||||
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(settings, force);
|
||||
MsgConfigureRemoteTCPSink *msg = MsgConfigureRemoteTCPSink::create(settings, channelSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
qDebug("RemoteTCPSink::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureRemoteTCPSink *msgToGUI = MsgConfigureRemoteTCPSink::create(settings, force);
|
||||
MsgConfigureRemoteTCPSink *msgToGUI = MsgConfigureRemoteTCPSink::create(settings, channelSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -467,7 +440,7 @@ void RemoteTCPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings&
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteTCPSink::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const RemoteTCPSinkSettings& settings, bool force)
|
||||
void RemoteTCPSink::webapiReverseSendSettings(const QStringList& channelSettingsKeys, const RemoteTCPSinkSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||
@ -494,7 +467,7 @@ void RemoteTCPSink::webapiReverseSendSettings(QList<QString>& channelSettingsKey
|
||||
|
||||
void RemoteTCPSink::sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QStringList& channelSettingsKeys,
|
||||
const RemoteTCPSinkSettings& settings,
|
||||
bool force)
|
||||
{
|
||||
@ -518,7 +491,7 @@ void RemoteTCPSink::sendChannelSettings(
|
||||
}
|
||||
|
||||
void RemoteTCPSink::webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const RemoteTCPSinkSettings& settings,
|
||||
bool force
|
||||
|
@ -39,22 +39,25 @@ public:
|
||||
|
||||
public:
|
||||
const RemoteTCPSinkSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
bool getRemoteChange() const { return m_remoteChange; }
|
||||
|
||||
static MsgConfigureRemoteTCPSink* create(const RemoteTCPSinkSettings& settings, bool force, bool remoteChange = false)
|
||||
static MsgConfigureRemoteTCPSink* create(const RemoteTCPSinkSettings& settings, const QList<QString>& settingsKeys, bool force, bool remoteChange = false)
|
||||
{
|
||||
return new MsgConfigureRemoteTCPSink(settings, force, remoteChange);
|
||||
return new MsgConfigureRemoteTCPSink(settings, settingsKeys, force, remoteChange);
|
||||
}
|
||||
|
||||
private:
|
||||
RemoteTCPSinkSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
bool m_remoteChange; // This change of settings was requested by a remote client, so no need to restart server
|
||||
|
||||
MsgConfigureRemoteTCPSink(const RemoteTCPSinkSettings& settings, bool force, bool remoteChange) :
|
||||
MsgConfigureRemoteTCPSink(const RemoteTCPSinkSettings& settings, const QList<QString>& settingsKeys, bool force, bool remoteChange) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force),
|
||||
m_remoteChange(remoteChange)
|
||||
{ }
|
||||
@ -180,16 +183,16 @@ private:
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, bool force = false, bool remoteChange = false);
|
||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const RemoteTCPSinkSettings& settings, bool force);
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force = false, bool remoteChange = false);
|
||||
void webapiReverseSendSettings(const QStringList& channelSettingsKeys, const RemoteTCPSinkSettings& settings, bool force);
|
||||
void sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QStringList& channelSettingsKeys,
|
||||
const RemoteTCPSinkSettings& settings,
|
||||
bool force
|
||||
);
|
||||
void webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const RemoteTCPSinkSettings& settings,
|
||||
bool force
|
||||
|
@ -128,7 +128,7 @@ bool RemoteTCPSinkBaseband::handleMessage(const Message& cmd)
|
||||
RemoteTCPSink::MsgConfigureRemoteTCPSink& cfg = (RemoteTCPSink::MsgConfigureRemoteTCPSink&) cmd;
|
||||
qDebug() << "RemoteTCPSinkBaseband::handleMessage: MsgConfigureRemoteTCPSink";
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce(), cfg.getRemoteChange());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce(), cfg.getRemoteChange());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -147,22 +147,25 @@ bool RemoteTCPSinkBaseband::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteTCPSinkBaseband::applySettings(const RemoteTCPSinkSettings& settings, bool force, bool remoteChange)
|
||||
void RemoteTCPSinkBaseband::applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force, bool remoteChange)
|
||||
{
|
||||
qDebug() << "RemoteTCPSinkBaseband::applySettings:"
|
||||
<< "m_channelSampleRate:" << settings.m_channelSampleRate
|
||||
<< "m_inputFrequencyOffset:" << settings.m_inputFrequencyOffset
|
||||
<< " force: " << force;
|
||||
|
||||
if ((settings.m_channelSampleRate != m_settings.m_channelSampleRate)
|
||||
|| (settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force)
|
||||
if (settingsKeys.contains("channelSampleRate") || settingsKeys.contains("inputFrequencyOffset") || force)
|
||||
{
|
||||
m_channelizer->setChannelization(settings.m_channelSampleRate, settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
}
|
||||
|
||||
m_sink.applySettings(settings, force, remoteChange);
|
||||
m_settings = settings;
|
||||
m_sink.applySettings(settings, settingsKeys, force, remoteChange);
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
int RemoteTCPSinkBaseband::getChannelSampleRate() const
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
QRecursiveMutex m_mutex;
|
||||
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, bool force = false, bool remoteChange = false);
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force = false, bool remoteChange = false);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
|
@ -17,6 +17,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QLocale>
|
||||
#include <QHostAddress>
|
||||
#include <QNetworkInterface>
|
||||
|
||||
#include "device/deviceuiset.h"
|
||||
#include "gui/basicchannelsettingsdialog.h"
|
||||
@ -46,7 +48,7 @@ void RemoteTCPSinkGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
applyAllSettings();
|
||||
}
|
||||
|
||||
QByteArray RemoteTCPSinkGUI::serialize() const
|
||||
@ -58,7 +60,7 @@ bool RemoteTCPSinkGUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data)) {
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
applyAllSettings();
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
@ -113,7 +115,11 @@ bool RemoteTCPSinkGUI::handleMessage(const Message& message)
|
||||
|| (cfg.getSettings().m_sampleBits != m_settings.m_sampleBits)) {
|
||||
m_bwAvg.reset();
|
||||
}
|
||||
m_settings = cfg.getSettings();
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
blockApplySettings(true);
|
||||
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
||||
displaySettings();
|
||||
@ -160,8 +166,7 @@ RemoteTCPSinkGUI::RemoteTCPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISe
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_basebandSampleRate(0),
|
||||
m_deviceCenterFrequency(0),
|
||||
m_tickCount(0)
|
||||
m_deviceCenterFrequency(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
m_helpURL = "plugins/channelrx/remotetcpsink/readme.md";
|
||||
@ -194,18 +199,27 @@ RemoteTCPSinkGUI::RemoteTCPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISe
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||
|
||||
// Add all IP addresses
|
||||
for (const QHostAddress& address: QNetworkInterface::allAddresses())
|
||||
{
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol && !address.isLoopback()) {
|
||||
ui->dataAddress->addItem(address.toString());
|
||||
}
|
||||
}
|
||||
|
||||
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
|
||||
displaySettings();
|
||||
makeUIConnections();
|
||||
applySettings(true);
|
||||
applyAllSettings();
|
||||
DialPopup::addPopupsToChildDials(this);
|
||||
}
|
||||
|
||||
RemoteTCPSinkGUI::~RemoteTCPSinkGUI()
|
||||
{
|
||||
QObject::disconnect(ui->dataAddress->lineEdit(), &QLineEdit::editingFinished, this, &RemoteTCPSinkGUI::on_dataAddress_editingFinished);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -214,17 +228,27 @@ void RemoteTCPSinkGUI::blockApplySettings(bool block)
|
||||
m_doApplySettings = !block;
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::applySettings(bool force)
|
||||
void RemoteTCPSinkGUI::applySetting(const QString& settingsKey)
|
||||
{
|
||||
applySettings({settingsKey});
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::applySettings(const QStringList& settingsKeys, bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
setTitleColor(m_channelMarker.getColor());
|
||||
|
||||
RemoteTCPSink::MsgConfigureRemoteTCPSink* message = RemoteTCPSink::MsgConfigureRemoteTCPSink::create(m_settings, force);
|
||||
RemoteTCPSink::MsgConfigureRemoteTCPSink* message = RemoteTCPSink::MsgConfigureRemoteTCPSink::create(m_settings, settingsKeys, force);
|
||||
m_remoteSink->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::applyAllSettings()
|
||||
{
|
||||
applySettings(QStringList(), true);
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::displaySettings()
|
||||
{
|
||||
m_channelMarker.blockSignals(true);
|
||||
@ -244,7 +268,10 @@ void RemoteTCPSinkGUI::displaySettings()
|
||||
ui->gain->setValue(m_settings.m_gain);
|
||||
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
|
||||
ui->sampleBits->setCurrentIndex(m_settings.m_sampleBits/8 - 1);
|
||||
ui->dataAddress->setText(m_settings.m_dataAddress);
|
||||
if (ui->dataAddress->findText(m_settings.m_dataAddress) == -1) {
|
||||
ui->dataAddress->addItem(m_settings.m_dataAddress);
|
||||
}
|
||||
ui->dataAddress->setCurrentText(m_settings.m_dataAddress);
|
||||
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
||||
ui->protocol->setCurrentIndex((int)m_settings.m_protocol);
|
||||
getRollupContents()->restoreState(m_rollupState);
|
||||
@ -288,7 +315,7 @@ void RemoteTCPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
(void) rollDown;
|
||||
|
||||
getRollupContents()->saveState(m_rollupState);
|
||||
applySettings();
|
||||
applySetting("rollupState");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::onMenuDialogCalled(const QPoint &p)
|
||||
@ -325,14 +352,26 @@ void RemoteTCPSinkGUI::onMenuDialogCalled(const QPoint &p)
|
||||
setTitle(m_channelMarker.getTitle());
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
QList<QString> settingsKeys({
|
||||
"m_rgbColor",
|
||||
"title",
|
||||
"useReverseAPI",
|
||||
"reverseAPIAddress",
|
||||
"reverseAPIPort",
|
||||
"reverseAPIDeviceIndex",
|
||||
"reverseAPIChannelIndex"
|
||||
});
|
||||
|
||||
if (m_deviceUISet->m_deviceMIMOEngine)
|
||||
{
|
||||
settingsKeys.append("streamIndex");
|
||||
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
||||
m_channelMarker.clearStreamIndexes();
|
||||
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
||||
updateIndexLabel();
|
||||
}
|
||||
|
||||
applySettings();
|
||||
applySettings(settingsKeys);
|
||||
}
|
||||
|
||||
resetContextMenuType();
|
||||
@ -342,7 +381,7 @@ void RemoteTCPSinkGUI::channelMarkerChangedByCursor()
|
||||
{
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettings();
|
||||
applySetting("inputFrequencyOffset");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::channelMarkerHighlightedByCursor()
|
||||
@ -353,34 +392,42 @@ void RemoteTCPSinkGUI::channelMarkerHighlightedByCursor()
|
||||
void RemoteTCPSinkGUI::on_deltaFrequency_changed(int index)
|
||||
{
|
||||
m_settings.m_inputFrequencyOffset = index;
|
||||
applySettings();
|
||||
applySetting("inputFrequencyOffset");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_channelSampleRate_changed(int index)
|
||||
{
|
||||
m_settings.m_channelSampleRate = index;
|
||||
m_bwAvg.reset();
|
||||
applySettings();
|
||||
applySetting("channelSampleRate");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_gain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_gain = (float)value;
|
||||
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
|
||||
applySettings();
|
||||
applySetting("gain");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_sampleBits_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_sampleBits = 8 * (index + 1);
|
||||
m_bwAvg.reset();
|
||||
applySettings();
|
||||
applySetting("sampleBits");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_dataAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||
applySettings();
|
||||
m_settings.m_dataAddress = ui->dataAddress->currentText();
|
||||
applySetting("dataAddress");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_dataAddress_currentIndexChanged(int index)
|
||||
{
|
||||
(void) index;
|
||||
|
||||
m_settings.m_dataAddress = ui->dataAddress->currentText();
|
||||
applySetting("dataAddress");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_dataPort_editingFinished()
|
||||
@ -397,20 +444,13 @@ void RemoteTCPSinkGUI::on_dataPort_editingFinished()
|
||||
m_settings.m_dataPort = dataPort;
|
||||
}
|
||||
|
||||
applySettings();
|
||||
applySetting("dataPort");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::on_protocol_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_protocol = (RemoteTCPSinkSettings::Protocol)index;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::tick()
|
||||
{
|
||||
if (++m_tickCount == 20) { // once per second
|
||||
m_tickCount = 0;
|
||||
}
|
||||
applySetting("protocol");
|
||||
}
|
||||
|
||||
void RemoteTCPSinkGUI::makeUIConnections()
|
||||
@ -419,7 +459,8 @@ void RemoteTCPSinkGUI::makeUIConnections()
|
||||
QObject::connect(ui->channelSampleRate, &ValueDial::changed, this, &RemoteTCPSinkGUI::on_channelSampleRate_changed);
|
||||
QObject::connect(ui->gain, &QDial::valueChanged, this, &RemoteTCPSinkGUI::on_gain_valueChanged);
|
||||
QObject::connect(ui->sampleBits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteTCPSinkGUI::on_sampleBits_currentIndexChanged);
|
||||
QObject::connect(ui->dataAddress, &QLineEdit::editingFinished, this, &RemoteTCPSinkGUI::on_dataAddress_editingFinished);
|
||||
QObject::connect(ui->dataAddress->lineEdit(), &QLineEdit::editingFinished, this, &RemoteTCPSinkGUI::on_dataAddress_editingFinished);
|
||||
QObject::connect(ui->dataAddress, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteTCPSinkGUI::on_dataAddress_currentIndexChanged);
|
||||
QObject::connect(ui->dataPort, &QLineEdit::editingFinished, this, &RemoteTCPSinkGUI::on_dataPort_editingFinished);
|
||||
QObject::connect(ui->protocol, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &RemoteTCPSinkGUI::on_protocol_currentIndexChanged);
|
||||
}
|
||||
|
@ -81,14 +81,15 @@ private:
|
||||
RemoteTCPSink* m_remoteSink;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
uint32_t m_tickCount;
|
||||
MovingAverageUtil<float, float, 10> m_bwAvg;
|
||||
|
||||
explicit RemoteTCPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
||||
virtual ~RemoteTCPSinkGUI();
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void applySetting(const QString& settingsKey);
|
||||
void applySettings(const QStringList& settingsKeys, bool force = false);
|
||||
void applyAllSettings();
|
||||
void displaySettings();
|
||||
void displayRateAndShift();
|
||||
bool handleMessage(const Message& message);
|
||||
@ -109,11 +110,11 @@ private slots:
|
||||
void on_gain_valueChanged(int value);
|
||||
void on_sampleBits_currentIndexChanged(int index);
|
||||
void on_dataAddress_editingFinished();
|
||||
void on_dataAddress_currentIndexChanged(int index);
|
||||
void on_dataPort_editingFinished();
|
||||
void on_protocol_currentIndexChanged(int index);
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDialogCalled(const QPoint& p);
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_CHANNELRX_REMOTETCPSINK_REMOTETCPSINKGUI_H_ */
|
||||
|
@ -308,21 +308,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dataAddress">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QComboBox" name="dataAddress">
|
||||
<property name="toolTip">
|
||||
<string>IP address of local network interface to start TCP server on</string>
|
||||
<string>IP address of local network interface to start TCP server on. Use 0.0.0.0 for any interface.</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0...</string>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -35,7 +35,7 @@ void RemoteTCPSinkSettings::resetToDefaults()
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_gain = 0;
|
||||
m_sampleBits = 8;
|
||||
m_dataAddress = "127.0.0.1";
|
||||
m_dataAddress = "0.0.0.0";
|
||||
m_dataPort = 1234;
|
||||
m_protocol = SDRA;
|
||||
m_rgbColor = QColor(140, 4, 4).rgb();
|
||||
@ -106,7 +106,7 @@ bool RemoteTCPSinkSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(2, &m_inputFrequencyOffset, 0);
|
||||
d.readS32(3, &m_gain, 0);
|
||||
d.readU32(4, &m_sampleBits, 8);
|
||||
d.readString(5, &m_dataAddress, "127.0.0.1");
|
||||
d.readString(5, &m_dataAddress, "0.0.0.0");
|
||||
d.readU32(6, &tmp, 0);
|
||||
|
||||
if ((tmp > 1023) && (tmp < 65535)) {
|
||||
@ -158,3 +158,117 @@ bool RemoteTCPSinkSettings::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteTCPSinkSettings::applySettings(const QStringList& settingsKeys, const RemoteTCPSinkSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("channelSampleRate")) {
|
||||
m_channelSampleRate = settings.m_channelSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("inputFrequencyOffset")) {
|
||||
m_inputFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
}
|
||||
if (settingsKeys.contains("gain")) {
|
||||
m_gain = settings.m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("sampleBits")) {
|
||||
m_sampleBits = settings.m_sampleBits;
|
||||
}
|
||||
if (settingsKeys.contains("dataAddress")) {
|
||||
m_dataAddress = settings.m_dataAddress;
|
||||
}
|
||||
if (settingsKeys.contains("dataPort")) {
|
||||
m_dataPort = settings.m_dataPort;
|
||||
}
|
||||
if (settingsKeys.contains("protocol")) {
|
||||
m_protocol = settings.m_protocol;
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor")) {
|
||||
m_rgbColor = settings.m_rgbColor;
|
||||
}
|
||||
if (settingsKeys.contains("title")) {
|
||||
m_title = settings.m_title;
|
||||
}
|
||||
if (settingsKeys.contains("streamIndex")) {
|
||||
m_streamIndex = settings.m_streamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
m_reverseAPIChannelIndex = settings.m_reverseAPIChannelIndex;
|
||||
}
|
||||
if (settingsKeys.contains("workspaceIndex")) {
|
||||
m_workspaceIndex = settings.m_workspaceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("hidden")) {
|
||||
m_hidden = settings.m_hidden;
|
||||
}
|
||||
}
|
||||
|
||||
QString RemoteTCPSinkSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("channelSampleRate") || force) {
|
||||
ostr << " m_channelSampleRate: " << m_channelSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("inputFrequencyOffset") || force) {
|
||||
ostr << " m_inputFrequencyOffset: " << m_inputFrequencyOffset;
|
||||
}
|
||||
if (settingsKeys.contains("gain") || force) {
|
||||
ostr << " m_gain: " << m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("sampleBits") || force) {
|
||||
ostr << " m_sampleBits: " << m_sampleBits;
|
||||
}
|
||||
if (settingsKeys.contains("dataAddress") || force) {
|
||||
ostr << " m_dataAddress: " << m_dataAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("dataPort") || force) {
|
||||
ostr << " m_dataPort: " << m_dataPort;
|
||||
}
|
||||
if (settingsKeys.contains("protocol") || force) {
|
||||
ostr << " m_protocol: " << m_protocol;
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor") || force) {
|
||||
ostr << " m_rgbColor: " << m_rgbColor;
|
||||
}
|
||||
if (settingsKeys.contains("title") || force) {
|
||||
ostr << " m_title: " << m_title.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("streamIndex") || force) {
|
||||
ostr << " m_streamIndex: " << m_streamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIChannelIndex") || force) {
|
||||
ostr << " m_reverseAPIChannelIndex: " << m_reverseAPIChannelIndex;
|
||||
}
|
||||
if (settingsKeys.contains("workspaceIndex") || force) {
|
||||
ostr << " m_workspaceIndex: " << m_workspaceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("hidden") || force) {
|
||||
ostr << " m_hidden: " << m_hidden;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ struct RemoteTCPSinkSettings
|
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const RemoteTCPSinkSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* INCLUDE_REMOTECHANNELSINKSETTINGS_H_ */
|
||||
|
@ -39,7 +39,7 @@ RemoteTCPSinkSink::RemoteTCPSinkSink() :
|
||||
m_server(nullptr)
|
||||
{
|
||||
qDebug("RemoteTCPSinkSink::RemoteTCPSinkSink");
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QStringList(), true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
}
|
||||
|
||||
@ -237,21 +237,18 @@ void RemoteTCPSinkSink::applyChannelSettings(int channelSampleRate, int channelF
|
||||
m_channelFrequencyOffset = channelFrequencyOffset;
|
||||
}
|
||||
|
||||
void RemoteTCPSinkSink::applySettings(const RemoteTCPSinkSettings& settings, bool force, bool remoteChange)
|
||||
void RemoteTCPSinkSink::applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force, bool remoteChange)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
qDebug() << "RemoteTCPSinkSink::applySettings:"
|
||||
<< " m_dataAddress: " << settings.m_dataAddress
|
||||
<< " m_dataPort: " << settings.m_dataPort
|
||||
<< " m_channelSampleRate: " << settings.m_channelSampleRate
|
||||
<< " m_streamIndex: " << settings.m_streamIndex
|
||||
<< " force: " << force
|
||||
<< " remoteChange: " << remoteChange;
|
||||
qDebug() << "RemoteTCPSinkSink::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force;
|
||||
|
||||
m_linearGain = powf(10.0f, m_settings.m_gain/20.0f);
|
||||
if (settingsKeys.contains("gain") || force)
|
||||
{
|
||||
m_linearGain = powf(10.0f, settings.m_gain/20.0f);
|
||||
}
|
||||
|
||||
if ((m_settings.m_channelSampleRate != settings.m_channelSampleRate) || force)
|
||||
if (settingsKeys.contains("channelSampleRate") || force)
|
||||
{
|
||||
m_interpolator.create(16, m_channelSampleRate, settings.m_channelSampleRate / 2.0);
|
||||
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) settings.m_channelSampleRate;
|
||||
@ -259,15 +256,19 @@ void RemoteTCPSinkSink::applySettings(const RemoteTCPSinkSettings& settings, boo
|
||||
}
|
||||
|
||||
// Do clients need to reconnect to get these updated settings?
|
||||
bool restart = (m_settings.m_dataAddress != settings.m_dataAddress)
|
||||
|| (m_settings.m_dataPort != settings.m_dataPort)
|
||||
|| (m_settings.m_sampleBits != settings.m_sampleBits)
|
||||
|| (m_settings.m_protocol != settings.m_protocol)
|
||||
bool restart = (settingsKeys.contains("dataAddress") && (m_settings.m_dataAddress != settings.m_dataAddress))
|
||||
|| (settingsKeys.contains("dataPort") && (m_settings.m_dataPort != settings.m_dataPort))
|
||||
|| (settingsKeys.contains("sampleBits") && (m_settings.m_sampleBits != settings.m_sampleBits))
|
||||
|| (settingsKeys.contains("protocol") && (m_settings.m_protocol != settings.m_protocol))
|
||||
|| ( !remoteChange
|
||||
&& (m_settings.m_channelSampleRate != settings.m_channelSampleRate)
|
||||
&& (settingsKeys.contains("channelSampleRate") && (m_settings.m_channelSampleRate != settings.m_channelSampleRate))
|
||||
);
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
if (m_running && restart) {
|
||||
startServer();
|
||||
@ -279,14 +280,14 @@ void RemoteTCPSinkSink::startServer()
|
||||
stopServer();
|
||||
|
||||
m_server = new QTcpServer(this);
|
||||
if (!m_server->listen(QHostAddress::Any, m_settings.m_dataPort))
|
||||
if (!m_server->listen(QHostAddress(m_settings.m_dataAddress), m_settings.m_dataPort))
|
||||
{
|
||||
qDebug() << "RemoteTCPSinkSink::startServer: failed to listen on port " << m_settings.m_dataPort;
|
||||
qCritical() << "RemoteTCPSink failed to listen on" << m_settings.m_dataAddress << "port" << m_settings.m_dataPort;
|
||||
// FIXME: Report to GUI?
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "RemoteTCPSinkSink::startServer: listening on port " << m_settings.m_dataPort;
|
||||
qInfo() << "RemoteTCPSink listening on" << m_settings.m_dataAddress << "port" << m_settings.m_dataPort;
|
||||
connect(m_server, &QTcpServer::newConnection, this, &RemoteTCPSinkSink::acceptConnection);
|
||||
}
|
||||
}
|
||||
@ -339,7 +340,6 @@ RemoteTCPProtocol::Device RemoteTCPSinkSink::getDevice()
|
||||
{"PlutoSDR", RemoteTCPProtocol::PLUTO_SDR},
|
||||
{"RemoteInput", RemoteTCPProtocol::REMOTE_INPUT},
|
||||
{"RemoteTCPInput", RemoteTCPProtocol::REMOTE_TCP_INPUT},
|
||||
{"RTLSDR", RemoteTCPProtocol::RTLSDR_R820T},
|
||||
{"SDRplay1", RemoteTCPProtocol::SDRPLAY_1},
|
||||
{"SigMFFileInput", RemoteTCPProtocol::SIGMF_FILE_INPUT},
|
||||
{"SoapySDR", RemoteTCPProtocol::SOAPY_SDR},
|
||||
@ -373,6 +373,29 @@ RemoteTCPProtocol::Device RemoteTCPSinkSink::getDevice()
|
||||
qDebug() << "RemoteTCPSinkSink::getDevice: Failed to get deviceType for SDRplayV3";
|
||||
}
|
||||
}
|
||||
else if (id == "RTLSDR")
|
||||
{
|
||||
QString tunerType;
|
||||
if (ChannelWebAPIUtils::getDeviceReportValue(m_deviceIndex, "tunerType", tunerType))
|
||||
{
|
||||
QHash<QString, RemoteTCPProtocol::Device> rtlsdrMap = {
|
||||
{"E4000", RemoteTCPProtocol::RTLSDR_E4000},
|
||||
{"FC0012", RemoteTCPProtocol::RTLSDR_FC0012},
|
||||
{"FC0013", RemoteTCPProtocol::RTLSDR_FC0013},
|
||||
{"FC2580", RemoteTCPProtocol::RTLSDR_FC2580},
|
||||
{"R820T", RemoteTCPProtocol::RTLSDR_R820T},
|
||||
{"R828D", RemoteTCPProtocol::RTLSDR_R828D},
|
||||
};
|
||||
if (rtlsdrMap.contains(tunerType)) {
|
||||
return rtlsdrMap.value(tunerType);
|
||||
}
|
||||
qDebug() << "RemoteTCPSinkSink::getDevice: Unknown RTLSDR tunerType: " << tunerType;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "RemoteTCPSinkSink::getDevice: Failed to get tunerType for RTLSDR";
|
||||
}
|
||||
}
|
||||
}
|
||||
return RemoteTCPProtocol::UNKNOWN;
|
||||
}
|
||||
@ -594,10 +617,10 @@ void RemoteTCPSinkSink::processCommand()
|
||||
qDebug() << "RemoteTCPSinkSink::processCommand: set channel sample rate " << channelSampleRate;
|
||||
settings.m_channelSampleRate = channelSampleRate;
|
||||
if (m_messageQueueToGUI) {
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"channelSampleRate"}, false, true));
|
||||
}
|
||||
if (m_messageQueueToChannel) {
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"channelSampleRate"}, false, true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -607,10 +630,10 @@ void RemoteTCPSinkSink::processCommand()
|
||||
qDebug() << "RemoteTCPSinkSink::processCommand: set channel input frequency offset " << offset;
|
||||
settings.m_inputFrequencyOffset = offset;
|
||||
if (m_messageQueueToGUI) {
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"inputFrequencyOffset"}, false, true));
|
||||
}
|
||||
if (m_messageQueueToChannel) {
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"inputFrequencyOffset"}, false, true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -620,10 +643,10 @@ void RemoteTCPSinkSink::processCommand()
|
||||
qDebug() << "RemoteTCPSinkSink::processCommand: set channel gain " << gain;
|
||||
settings.m_gain = gain;
|
||||
if (m_messageQueueToGUI) {
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"gain"}, false, true));
|
||||
}
|
||||
if (m_messageQueueToChannel) {
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"gain"}, false, true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -633,10 +656,10 @@ void RemoteTCPSinkSink::processCommand()
|
||||
qDebug() << "RemoteTCPSinkSink::processCommand: set sample bit depth " << bits;
|
||||
settings.m_sampleBits = bits;
|
||||
if (m_messageQueueToGUI) {
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"sampleBits"}, false, true));
|
||||
}
|
||||
if (m_messageQueueToChannel) {
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, false, true));
|
||||
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"sampleBits"}, false, true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
void stop();
|
||||
void init();
|
||||
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, bool force = false, bool remoteChange = false);
|
||||
void applySettings(const RemoteTCPSinkSettings& settings, const QStringList& settingsKeys, bool force = false, bool remoteChange = false);
|
||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||
void setDeviceIndex(uint32_t deviceIndex) { m_deviceIndex = deviceIndex; }
|
||||
void setChannelIndex(uint32_t channelIndex) { m_channelIndex = channelIndex; }
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -780,6 +780,8 @@ void RTLSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respons
|
||||
response.getRtlSdrReport()->getGains()->append(new SWGSDRangel::SWGGain);
|
||||
response.getRtlSdrReport()->getGains()->back()->setGainCb(*it);
|
||||
}
|
||||
|
||||
response.getRtlSdrReport()->setTunerType(new QString(getTunerName()));
|
||||
}
|
||||
|
||||
void RTLSDRInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force)
|
||||
|
@ -171,6 +171,7 @@ bool SDRPlayV3Gui::handleMessage(const Message& message)
|
||||
if (SDRPlayV3Input::MsgConfigureSDRPlayV3::match(message))
|
||||
{
|
||||
const SDRPlayV3Input::MsgConfigureSDRPlayV3& cfg = (SDRPlayV3Input::MsgConfigureSDRPlayV3&) message;
|
||||
qDebug() << "SDRPlayV3Gui::handleMessage: MsgConfigureSDRPlayV3: " << cfg.getSettings().getDebugString(cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
@ -313,6 +314,7 @@ void SDRPlayV3Gui::updateLNAValues()
|
||||
|
||||
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
|
||||
int len = attenuations[0];
|
||||
ui->gainLNA->blockSignals(true);
|
||||
ui->gainLNA->clear();
|
||||
for (int i = 1; i <= len; i++)
|
||||
{
|
||||
@ -328,6 +330,7 @@ void SDRPlayV3Gui::updateLNAValues()
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
ui->gainLNA->blockSignals(false);
|
||||
}
|
||||
|
||||
void SDRPlayV3Gui::sendSettings()
|
||||
|
@ -778,14 +778,24 @@ int SDRPlayV3Input::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) errorMessage;
|
||||
SDRPlayV3Settings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
QStringList deviceSettingsKeysModifiable = deviceSettingsKeys;
|
||||
|
||||
MsgConfigureSDRPlayV3 *msg = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeys, force);
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeysModifiable, response);
|
||||
|
||||
// Convert lnaGain to lnaIndex
|
||||
if (deviceSettingsKeysModifiable.contains("lnaGain"))
|
||||
{
|
||||
int lnaGain = response.getSdrPlayV3Settings()->getLnaGain();
|
||||
settings.m_lnaIndex = mapLNAGainDBToLNAIndex(lnaGain, settings.m_centerFrequency);
|
||||
deviceSettingsKeysModifiable.append("lnaIndex");
|
||||
}
|
||||
|
||||
MsgConfigureSDRPlayV3 *msg = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeysModifiable, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureSDRPlayV3 *msgToGUI = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeys, force);
|
||||
MsgConfigureSDRPlayV3 *msgToGUI = MsgConfigureSDRPlayV3::create(settings, deviceSettingsKeysModifiable, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -893,6 +903,7 @@ void SDRPlayV3Input::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
|
||||
response.getSdrPlayV3Settings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
|
||||
response.getSdrPlayV3Settings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
|
||||
response.getSdrPlayV3Settings()->setLnaIndex(settings.m_lnaIndex);
|
||||
response.getSdrPlayV3Settings()->setLnaGain(0); // Write only setting
|
||||
response.getSdrPlayV3Settings()->setIfAgc(settings.m_ifAGC ? 1 : 0);
|
||||
response.getSdrPlayV3Settings()->setIfGain(settings.m_ifGain);
|
||||
response.getSdrPlayV3Settings()->setAmNotch(settings.m_amNotch);
|
||||
@ -1011,6 +1022,9 @@ void SDRPlayV3Input::webapiReverseSendSettings(const QList<QString>& deviceSetti
|
||||
if (deviceSettingsKeys.contains("lnaIndex") || force) {
|
||||
swgSDRPlayV3Settings->setLnaIndex(settings.m_lnaIndex);
|
||||
}
|
||||
if (deviceSettingsKeys.contains("lnaGain") || force) {
|
||||
swgSDRPlayV3Settings->setLnaGain(0); // Write only setting
|
||||
}
|
||||
if (deviceSettingsKeys.contains("ifAGC") || force) {
|
||||
swgSDRPlayV3Settings->setIfAgc(settings.m_ifAGC ? 1 : 0);
|
||||
}
|
||||
@ -1118,7 +1132,7 @@ void SDRPlayV3Input::networkManagerFinished(QNetworkReply *reply)
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
int SDRPlayV3Input::getDeviceId()
|
||||
int SDRPlayV3Input::getDeviceId() const
|
||||
{
|
||||
if (m_dev != nullptr)
|
||||
return m_dev->hwVer; // E.g. SDRPLAY_RSPduo_ID
|
||||
@ -1126,6 +1140,33 @@ int SDRPlayV3Input::getDeviceId()
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Convert gain in dB to closest index
|
||||
int SDRPlayV3Input::mapLNAGainDBToLNAIndex(int gainDB, qint64 frequency) const
|
||||
{
|
||||
const int *attenuations = SDRPlayV3LNA::getAttenuations(getDeviceId(), frequency);
|
||||
int len = attenuations[0];
|
||||
|
||||
for (int i = 1; i <= len; i++)
|
||||
{
|
||||
if (gainDB >= -attenuations[i]) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
return len - 1;
|
||||
}
|
||||
|
||||
// Convert index to gain in dB
|
||||
int SDRPlayV3Input::mapLNAIndexToLNAGainDB(int lnaIndex, qint64 frequency) const
|
||||
{
|
||||
const int *attenuations = SDRPlayV3LNA::getAttenuations(getDeviceId(), frequency);
|
||||
int len = attenuations[0];
|
||||
if (lnaIndex < len) {
|
||||
return attenuations[lnaIndex+1];
|
||||
} else {
|
||||
return -1000;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
sdrplay_api_Bw_MHzT SDRPlayV3Bandwidths::m_bwEnums[m_nb_bw] = {
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
int getDeviceId();
|
||||
int getDeviceId() const;
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
@ -157,6 +157,8 @@ private:
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
int mapLNAGainDBToLNAIndex(int gainDB, qint64 frequency) const;
|
||||
int mapLNAIndexToLNAGainDB(int lnaIndex, qint64 frequency) const;
|
||||
|
||||
private slots:
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
|
@ -502,10 +502,9 @@ bool ChannelWebAPIUtils::getGain(unsigned int deviceIndex, int stage, int &gain)
|
||||
}
|
||||
else if ((devId == "SDRplayV3"))
|
||||
{
|
||||
QStringList sdrplayStages = {"lnaIndex", "ifGain"};
|
||||
QStringList sdrplayStages = {"lnaGain", "ifGain"};
|
||||
if (stage < sdrplayStages.size())
|
||||
{
|
||||
// FIXME: How to map to lnaIndex - gain can vary by SDR
|
||||
error = ChannelWebAPIUtils::getDeviceSetting(deviceIndex, sdrplayStages[stage], gain);
|
||||
gain *= 10;
|
||||
}
|
||||
@ -561,10 +560,8 @@ bool ChannelWebAPIUtils::setGain(unsigned int deviceIndex, int stage, int gain)
|
||||
}
|
||||
else if (devId == "SDRplayV3")
|
||||
{
|
||||
QStringList sdrplayStages = {"lnaIndex", "ifGain"};
|
||||
if (stage < sdrplayStages.size())
|
||||
{
|
||||
// FIXME: How to map to lnaIndex - gain can vary by SDR
|
||||
QStringList sdrplayStages = {"lnaGain", "ifGain"};
|
||||
if (stage < sdrplayStages.size()) {
|
||||
return ChannelWebAPIUtils::patchDeviceSetting(deviceIndex, sdrplayStages[stage], gain / 10);
|
||||
}
|
||||
}
|
||||
@ -1120,7 +1117,7 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr
|
||||
|
||||
if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet))
|
||||
{
|
||||
// Patch centerFrequency
|
||||
// Patch setting
|
||||
QJsonObject *jsonObj = deviceSettingsResponse.asJsonObject();
|
||||
int oldValue;
|
||||
if (WebAPIUtils::getSubObjectInt(*jsonObj, setting, oldValue))
|
||||
|
@ -38,7 +38,7 @@ MainParser::MainParser() :
|
||||
m_scratchOption("scratch", "Start from scratch (no current config)."),
|
||||
m_soapyOption("soapy", "Activate Soapy SDR support."),
|
||||
m_remoteTCPSinkOption("remote-tcp", "Start Remote TCP Sink"),
|
||||
m_remoteTCPSinkAddressOption("remote-tcp-address", "Remote TCP Sink interface IP address (Default 127.0.0.1).", "address", "127.0.0.1"),
|
||||
m_remoteTCPSinkAddressOption("remote-tcp-address", "Remote TCP Sink interface IP address (Default any).", "address", "0.0.0.0"),
|
||||
m_remoteTCPSinkPortOption("remote-tcp-port", "Remote TCP Sink port (Default 1234).", "port", "1234"),
|
||||
m_remoteTCPSinkHWTypeOption("remote-tcp-hwtype", "Remote TCP Sink device hardware type (Optional. E.g. RTLSDR/SDRplayV3/AirspyHF).", "hwtype"),
|
||||
m_remoteTCPSinkSerialOption("remote-tcp-serial", "Remote TCP Sink device serial (Optional).", "serial"),
|
||||
@ -51,7 +51,7 @@ MainParser::MainParser() :
|
||||
m_soapy = false;
|
||||
m_fftwfWindowFileName = "";
|
||||
m_remoteTCPSink = false;
|
||||
m_remoteTCPSinkAddress = "127.0.0.1";
|
||||
m_remoteTCPSinkAddress = "0.0.0.0";
|
||||
m_remoteTCPSinkPort = 1234;
|
||||
m_remoteTCPSinkHWType = "";
|
||||
m_remoteTCPSinkSerial = "";
|
||||
|
@ -62,3 +62,5 @@ RtlSdrReport:
|
||||
type: array
|
||||
items:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Gain"
|
||||
tunerType:
|
||||
type: string
|
||||
|
@ -22,6 +22,9 @@ SDRPlayV3Settings:
|
||||
type: integer
|
||||
lnaIndex:
|
||||
type: integer
|
||||
lnaGain:
|
||||
description: Gain in dB, as an alternative to lnaIndex setting
|
||||
type: integer
|
||||
ifAGC:
|
||||
type: integer
|
||||
ifGain:
|
||||
|
@ -30,6 +30,8 @@ SWGRtlSdrReport::SWGRtlSdrReport(QString* json) {
|
||||
SWGRtlSdrReport::SWGRtlSdrReport() {
|
||||
gains = nullptr;
|
||||
m_gains_isSet = false;
|
||||
tuner_type = nullptr;
|
||||
m_tuner_type_isSet = false;
|
||||
}
|
||||
|
||||
SWGRtlSdrReport::~SWGRtlSdrReport() {
|
||||
@ -40,6 +42,8 @@ void
|
||||
SWGRtlSdrReport::init() {
|
||||
gains = new QList<SWGGain*>();
|
||||
m_gains_isSet = false;
|
||||
tuner_type = new QString("");
|
||||
m_tuner_type_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -51,6 +55,9 @@ SWGRtlSdrReport::cleanup() {
|
||||
}
|
||||
delete gains;
|
||||
}
|
||||
if(tuner_type != nullptr) {
|
||||
delete tuner_type;
|
||||
}
|
||||
}
|
||||
|
||||
SWGRtlSdrReport*
|
||||
@ -66,6 +73,8 @@ void
|
||||
SWGRtlSdrReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&gains, pJson["gains"], "QList", "SWGGain");
|
||||
::SWGSDRangel::setValue(&tuner_type, pJson["tunerType"], "QString", "QString");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -85,6 +94,9 @@ SWGRtlSdrReport::asJsonObject() {
|
||||
if(gains && gains->size() > 0){
|
||||
toJsonArray((QList<void*>*)gains, obj, "gains", "SWGGain");
|
||||
}
|
||||
if(tuner_type != nullptr && *tuner_type != QString("")){
|
||||
toJsonValue(QString("tunerType"), tuner_type, obj, QString("QString"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -99,6 +111,16 @@ SWGRtlSdrReport::setGains(QList<SWGGain*>* gains) {
|
||||
this->m_gains_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGRtlSdrReport::getTunerType() {
|
||||
return tuner_type;
|
||||
}
|
||||
void
|
||||
SWGRtlSdrReport::setTunerType(QString* tuner_type) {
|
||||
this->tuner_type = tuner_type;
|
||||
this->m_tuner_type_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGRtlSdrReport::isSet(){
|
||||
@ -107,6 +129,9 @@ SWGRtlSdrReport::isSet(){
|
||||
if(gains && (gains->size() > 0)){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(tuner_type && *tuner_type != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "SWGGain.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
@ -46,6 +47,9 @@ public:
|
||||
QList<SWGGain*>* getGains();
|
||||
void setGains(QList<SWGGain*>* gains);
|
||||
|
||||
QString* getTunerType();
|
||||
void setTunerType(QString* tuner_type);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -53,6 +57,9 @@ private:
|
||||
QList<SWGGain*>* gains;
|
||||
bool m_gains_isSet;
|
||||
|
||||
QString* tuner_type;
|
||||
bool m_tuner_type_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ SWGSDRPlayV3Settings::SWGSDRPlayV3Settings() {
|
||||
m_iq_correction_isSet = false;
|
||||
lna_index = 0;
|
||||
m_lna_index_isSet = false;
|
||||
lna_gain = 0;
|
||||
m_lna_gain_isSet = false;
|
||||
if_agc = 0;
|
||||
m_if_agc_isSet = false;
|
||||
if_gain = 0;
|
||||
@ -108,6 +110,8 @@ SWGSDRPlayV3Settings::init() {
|
||||
m_iq_correction_isSet = false;
|
||||
lna_index = 0;
|
||||
m_lna_index_isSet = false;
|
||||
lna_gain = 0;
|
||||
m_lna_gain_isSet = false;
|
||||
if_agc = 0;
|
||||
m_if_agc_isSet = false;
|
||||
if_gain = 0;
|
||||
@ -165,6 +169,7 @@ SWGSDRPlayV3Settings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(reverse_api_address != nullptr) {
|
||||
@ -205,6 +210,8 @@ SWGSDRPlayV3Settings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&lna_index, pJson["lnaIndex"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&if_agc, pJson["ifAGC"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&if_gain, pJson["ifGain"], "qint32", "");
|
||||
@ -283,6 +290,9 @@ SWGSDRPlayV3Settings::asJsonObject() {
|
||||
if(m_lna_index_isSet){
|
||||
obj->insert("lnaIndex", QJsonValue(lna_index));
|
||||
}
|
||||
if(m_lna_gain_isSet){
|
||||
obj->insert("lnaGain", QJsonValue(lna_gain));
|
||||
}
|
||||
if(m_if_agc_isSet){
|
||||
obj->insert("ifAGC", QJsonValue(if_agc));
|
||||
}
|
||||
@ -435,6 +445,16 @@ SWGSDRPlayV3Settings::setLnaIndex(qint32 lna_index) {
|
||||
this->m_lna_index_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRPlayV3Settings::getLnaGain() {
|
||||
return lna_gain;
|
||||
}
|
||||
void
|
||||
SWGSDRPlayV3Settings::setLnaGain(qint32 lna_gain) {
|
||||
this->lna_gain = lna_gain;
|
||||
this->m_lna_gain_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRPlayV3Settings::getIfAgc() {
|
||||
return if_agc;
|
||||
@ -630,6 +650,9 @@ SWGSDRPlayV3Settings::isSet(){
|
||||
if(m_lna_index_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_lna_gain_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_if_agc_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
|
@ -72,6 +72,9 @@ public:
|
||||
qint32 getLnaIndex();
|
||||
void setLnaIndex(qint32 lna_index);
|
||||
|
||||
qint32 getLnaGain();
|
||||
void setLnaGain(qint32 lna_gain);
|
||||
|
||||
qint32 getIfAgc();
|
||||
void setIfAgc(qint32 if_agc);
|
||||
|
||||
@ -154,6 +157,9 @@ private:
|
||||
qint32 lna_index;
|
||||
bool m_lna_index_isSet;
|
||||
|
||||
qint32 lna_gain;
|
||||
bool m_lna_gain_isSet;
|
||||
|
||||
qint32 if_agc;
|
||||
bool m_if_agc_isSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user