mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-05 08:21:16 -05:00
Remote TCP Input: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
68c534f848
commit
b58d5b0a82
@ -85,7 +85,7 @@ void RemoteTCPInput::destroy()
|
|||||||
|
|
||||||
void RemoteTCPInput::init()
|
void RemoteTCPInput::init()
|
||||||
{
|
{
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, QList<QString>(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteTCPInput::start()
|
bool RemoteTCPInput::start()
|
||||||
@ -93,7 +93,7 @@ bool RemoteTCPInput::start()
|
|||||||
qDebug() << "RemoteTCPInput::start";
|
qDebug() << "RemoteTCPInput::start";
|
||||||
m_remoteInputTCPPHandler->reset();
|
m_remoteInputTCPPHandler->reset();
|
||||||
m_remoteInputTCPPHandler->start();
|
m_remoteInputTCPPHandler->start();
|
||||||
m_remoteInputTCPPHandler->getInputMessageQueue()->push(RemoteTCPInputTCPHandler::MsgConfigureTcpHandler::create(m_settings, true));
|
m_remoteInputTCPPHandler->getInputMessageQueue()->push(RemoteTCPInputTCPHandler::MsgConfigureTcpHandler::create(m_settings, QList<QString>(), true));
|
||||||
m_thread.start();
|
m_thread.start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -121,12 +121,12 @@ bool RemoteTCPInput::deserialize(const QByteArray& data)
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureRemoteTCPInput* message = MsgConfigureRemoteTCPInput::create(m_settings, true);
|
MsgConfigureRemoteTCPInput* message = MsgConfigureRemoteTCPInput::create(m_settings, QList<QString>(), true);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteTCPInput* messageToGUI = MsgConfigureRemoteTCPInput::create(m_settings, true);
|
MsgConfigureRemoteTCPInput* messageToGUI = MsgConfigureRemoteTCPInput::create(m_settings, QList<QString>(), true);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,12 +159,12 @@ void RemoteTCPInput::setCenterFrequency(qint64 centerFrequency)
|
|||||||
RemoteTCPInputSettings settings = m_settings;
|
RemoteTCPInputSettings settings = m_settings;
|
||||||
settings.m_centerFrequency = centerFrequency;
|
settings.m_centerFrequency = centerFrequency;
|
||||||
|
|
||||||
MsgConfigureRemoteTCPInput* message = MsgConfigureRemoteTCPInput::create(settings, false);
|
MsgConfigureRemoteTCPInput* message = MsgConfigureRemoteTCPInput::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteTCPInput* messageToGUI = MsgConfigureRemoteTCPInput::create(settings, false);
|
MsgConfigureRemoteTCPInput* messageToGUI = MsgConfigureRemoteTCPInput::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,8 +178,7 @@ bool RemoteTCPInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
{
|
{
|
||||||
if (m_deviceAPI->initDeviceEngine())
|
if (m_deviceAPI->initDeviceEngine()) {
|
||||||
{
|
|
||||||
m_deviceAPI->startDeviceEngine();
|
m_deviceAPI->startDeviceEngine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +197,7 @@ bool RemoteTCPInput::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInput::handleMessage:" << message.getIdentifier();
|
qDebug() << "RemoteTCPInput::handleMessage:" << message.getIdentifier();
|
||||||
MsgConfigureRemoteTCPInput& conf = (MsgConfigureRemoteTCPInput&) message;
|
MsgConfigureRemoteTCPInput& conf = (MsgConfigureRemoteTCPInput&) message;
|
||||||
applySettings(conf.getSettings(), conf.getForce());
|
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (RemoteTCPInputTCPHandler::MsgReportConnection::match(message))
|
else if (RemoteTCPInputTCPHandler::MsgReportConnection::match(message))
|
||||||
@ -218,89 +217,32 @@ bool RemoteTCPInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInput::applySettings(const RemoteTCPInputSettings& settings, bool force)
|
void RemoteTCPInput::applySettings(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
|
qDebug() << "RemoteTCPInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
QList<QString> reverseAPIKeys;
|
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
|
|
||||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
|
if (settingsKeys.contains("centerFrequency") || force) {
|
||||||
{
|
|
||||||
reverseAPIKeys.append("centerFrequency");
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
}
|
}
|
||||||
if ((m_settings.m_loPpmCorrection != settings.m_loPpmCorrection) || force) {
|
if (settingsKeys.contains("inputFrequencyOffset") || force) {
|
||||||
reverseAPIKeys.append("loPpmCorrection");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force) {
|
|
||||||
reverseAPIKeys.append("dcBlock");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force) {
|
|
||||||
reverseAPIKeys.append("iqCorrection");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_biasTee != settings.m_biasTee) || force) {
|
|
||||||
reverseAPIKeys.append("biasTee");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_directSampling != settings.m_directSampling) || force) {
|
|
||||||
reverseAPIKeys.append("noModMode"); // Use same name as rtlsdrinput.cpp
|
|
||||||
}
|
|
||||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) {
|
|
||||||
reverseAPIKeys.append("devSampleRate");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) {
|
|
||||||
reverseAPIKeys.append("log2Decim");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_gain != settings.m_gain) || force) {
|
|
||||||
reverseAPIKeys.append("gain");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_agc != settings.m_agc) || force) {
|
|
||||||
reverseAPIKeys.append("agc");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_rfBW != settings.m_rfBW) || force) {
|
|
||||||
reverseAPIKeys.append("rfBW");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_rfBW != settings.m_rfBW) || force) {
|
|
||||||
reverseAPIKeys.append("rfBW");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force)
|
|
||||||
{
|
|
||||||
reverseAPIKeys.append("inputFrequencyOffset");
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
}
|
}
|
||||||
if ((m_settings.m_channelGain != settings.m_channelGain) || force) {
|
if (settingsKeys.contains("channelSampleRate") || force) {
|
||||||
reverseAPIKeys.append("channelGain");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_channelSampleRate != settings.m_channelSampleRate) || force)
|
|
||||||
{
|
|
||||||
reverseAPIKeys.append("channelSampleRate");
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
}
|
}
|
||||||
if ((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force) {
|
|
||||||
reverseAPIKeys.append("inputFrequencyOffset");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_sampleBits != settings.m_sampleBits) || force) {
|
|
||||||
reverseAPIKeys.append("m_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_preFill != settings.m_preFill) || force) {
|
|
||||||
reverseAPIKeys.append("preFill");
|
|
||||||
}
|
|
||||||
|
|
||||||
mutexLocker.unlock();
|
mutexLocker.unlock();
|
||||||
|
|
||||||
if (settings.m_useReverseAPI)
|
if (settingsKeys.contains("useReverseAPI"))
|
||||||
{
|
{
|
||||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
settingsKeys.contains("reverseAPIAddress") ||
|
||||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
settingsKeys.contains("reverseAPIPort") ||
|
||||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex);
|
settingsKeys.contains("reverseAPIDeviceIndex");
|
||||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forwardChange && (settings.m_channelSampleRate != 0))
|
if (forwardChange && (settings.m_channelSampleRate != 0))
|
||||||
@ -309,28 +251,13 @@ void RemoteTCPInput::applySettings(const RemoteTCPInputSettings& settings, bool
|
|||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force) {
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
} else {
|
||||||
|
m_settings.applySettings(settingsKeys, settings);
|
||||||
|
}
|
||||||
|
|
||||||
m_remoteInputTCPPHandler->getInputMessageQueue()->push(RemoteTCPInputTCPHandler::MsgConfigureTcpHandler::create(m_settings, force));
|
m_remoteInputTCPPHandler->getInputMessageQueue()->push(RemoteTCPInputTCPHandler::MsgConfigureTcpHandler::create(m_settings, settingsKeys, force));
|
||||||
|
|
||||||
qDebug() << "RemoteTCPInput::applySettings: "
|
|
||||||
<< " force: " << force
|
|
||||||
<< " m_centerFrequency: " << m_settings.m_centerFrequency
|
|
||||||
<< " m_loPpmCorrection: " << m_settings.m_loPpmCorrection
|
|
||||||
<< " m_biasTee: " << m_settings.m_biasTee
|
|
||||||
<< " m_devSampleRate: " << m_settings.m_devSampleRate
|
|
||||||
<< " m_log2Decim: " << m_settings.m_log2Decim
|
|
||||||
<< " m_gain: " << m_settings.m_gain
|
|
||||||
<< " m_agc: " << m_settings.m_agc
|
|
||||||
<< " m_rfBW: " << m_settings.m_rfBW
|
|
||||||
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset
|
|
||||||
<< " m_channelGain: " << m_settings.m_channelGain
|
|
||||||
<< " m_channelSampleRate: " << m_settings.m_channelSampleRate
|
|
||||||
<< " m_sampleBits: " << m_settings.m_sampleBits
|
|
||||||
<< " m_dataAddress: " << m_settings.m_dataAddress
|
|
||||||
<< " m_dataPort: " << m_settings.m_dataPort
|
|
||||||
<< " m_preFill: " << m_settings.m_preFill
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RemoteTCPInput::webapiRunGet(
|
int RemoteTCPInput::webapiRunGet(
|
||||||
@ -382,12 +309,12 @@ int RemoteTCPInput::webapiSettingsPutPatch(
|
|||||||
RemoteTCPInputSettings settings = m_settings;
|
RemoteTCPInputSettings settings = m_settings;
|
||||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
MsgConfigureRemoteTCPInput *msg = MsgConfigureRemoteTCPInput::create(settings, force);
|
MsgConfigureRemoteTCPInput *msg = MsgConfigureRemoteTCPInput::create(settings, deviceSettingsKeys, force);
|
||||||
m_inputMessageQueue.push(msg);
|
m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
if (m_guiMessageQueue) // forward to GUI if any
|
if (m_guiMessageQueue) // forward to GUI if any
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteTCPInput *msgToGUI = MsgConfigureRemoteTCPInput::create(settings, force);
|
MsgConfigureRemoteTCPInput *msgToGUI = MsgConfigureRemoteTCPInput::create(settings, deviceSettingsKeys, force);
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +449,7 @@ void RemoteTCPInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
|||||||
response.getRemoteTcpInputReport()->setSampleRate(m_settings.m_channelSampleRate);
|
response.getRemoteTcpInputReport()->setSampleRate(m_settings.m_channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteTCPInputSettings& settings, bool force)
|
void RemoteTCPInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteTCPInputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(0); // single Rx
|
swgDeviceSettings->setDirection(0); // single Rx
|
||||||
|
@ -48,20 +48,22 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const RemoteTCPInputSettings& getSettings() const { return m_settings; }
|
const RemoteTCPInputSettings& getSettings() const { return m_settings; }
|
||||||
|
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureRemoteTCPInput* create(const RemoteTCPInputSettings& settings, bool force = false)
|
static MsgConfigureRemoteTCPInput* create(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force = false) {
|
||||||
{
|
return new MsgConfigureRemoteTCPInput(settings, settingsKeys, force);
|
||||||
return new MsgConfigureRemoteTCPInput(settings, force);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RemoteTCPInputSettings m_settings;
|
RemoteTCPInputSettings m_settings;
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureRemoteTCPInput(const RemoteTCPInputSettings& settings, bool force) :
|
MsgConfigureRemoteTCPInput(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
|
m_settingsKeys(settingsKeys),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -185,9 +187,9 @@ private:
|
|||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
QThread m_thread;
|
QThread m_thread;
|
||||||
|
|
||||||
void applySettings(const RemoteTCPInputSettings& settings, bool force = false);
|
void applySettings(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteTCPInputSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteTCPInputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -149,7 +149,13 @@ bool RemoteTCPInputGui::handleMessage(const Message& message)
|
|||||||
if (RemoteTCPInput::MsgConfigureRemoteTCPInput::match(message))
|
if (RemoteTCPInput::MsgConfigureRemoteTCPInput::match(message))
|
||||||
{
|
{
|
||||||
const RemoteTCPInput::MsgConfigureRemoteTCPInput& cfg = (RemoteTCPInput::MsgConfigureRemoteTCPInput&) message;
|
const RemoteTCPInput::MsgConfigureRemoteTCPInput& cfg = (RemoteTCPInput::MsgConfigureRemoteTCPInput&) message;
|
||||||
|
|
||||||
|
if (cfg.getForce()) {
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
|
} else {
|
||||||
|
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||||
|
}
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -522,17 +528,22 @@ void RemoteTCPInputGui::on_startStop_toggled(bool checked)
|
|||||||
void RemoteTCPInputGui::on_centerFrequency_changed(quint64 value)
|
void RemoteTCPInputGui::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
m_settings.m_centerFrequency = value * 1000;
|
||||||
|
m_settingsKeys.append("centerFrequency");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_devSampleRate_changed(quint64 value)
|
void RemoteTCPInputGui::on_devSampleRate_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRate = value;
|
m_settings.m_devSampleRate = value;
|
||||||
|
m_settingsKeys.append("devSampleRate");
|
||||||
|
|
||||||
if (!m_settings.m_channelDecimation)
|
if (!m_settings.m_channelDecimation)
|
||||||
{
|
{
|
||||||
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
||||||
|
m_settingsKeys.append("channelSampleRate");
|
||||||
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,47 +551,57 @@ void RemoteTCPInputGui::on_ppm_valueChanged(int value)
|
|||||||
{
|
{
|
||||||
m_settings.m_loPpmCorrection = value;
|
m_settings.m_loPpmCorrection = value;
|
||||||
ui->ppmText->setText(tr("%1").arg(value));
|
ui->ppmText->setText(tr("%1").arg(value));
|
||||||
|
m_settingsKeys.append("loPpmCorrection");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_dcOffset_toggled(bool checked)
|
void RemoteTCPInputGui::on_dcOffset_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_dcBlock = checked;
|
m_settings.m_dcBlock = checked;
|
||||||
|
m_settingsKeys.append("dcBlock");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_iqImbalance_toggled(bool checked)
|
void RemoteTCPInputGui::on_iqImbalance_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_iqCorrection = checked;
|
m_settings.m_iqCorrection = checked;
|
||||||
|
m_settingsKeys.append("iqCorrection");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_biasTee_toggled(bool checked)
|
void RemoteTCPInputGui::on_biasTee_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_biasTee = checked;
|
m_settings.m_biasTee = checked;
|
||||||
|
m_settingsKeys.append("biasTee");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_directSampling_toggled(bool checked)
|
void RemoteTCPInputGui::on_directSampling_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_directSampling = checked;
|
m_settings.m_directSampling = checked;
|
||||||
|
m_settingsKeys.append("directSampling");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_agc_toggled(bool checked)
|
void RemoteTCPInputGui::on_agc_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_agc = checked;
|
m_settings.m_agc = checked;
|
||||||
|
m_settingsKeys.append("agc");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_decim_currentIndexChanged(int index)
|
void RemoteTCPInputGui::on_decim_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_log2Decim = index;
|
m_settings.m_log2Decim = index;
|
||||||
|
m_settingsKeys.append("log2Decim");
|
||||||
|
|
||||||
if (!m_settings.m_channelDecimation)
|
if (!m_settings.m_channelDecimation)
|
||||||
{
|
{
|
||||||
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
||||||
|
m_settingsKeys.append("channelSampleRate");
|
||||||
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +612,9 @@ void RemoteTCPInputGui::on_gain1_valueChanged(int value)
|
|||||||
} else {
|
} else {
|
||||||
m_settings.m_gain[0] = value * 10;
|
m_settings.m_gain[0] = value * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->gain1Text->setText(gainText(0));
|
ui->gain1Text->setText(gainText(0));
|
||||||
|
m_settingsKeys.append("gain[0]");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +625,9 @@ void RemoteTCPInputGui::on_gain2_valueChanged(int value)
|
|||||||
} else {
|
} else {
|
||||||
m_settings.m_gain[1] = value * 10;
|
m_settings.m_gain[1] = value * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->gain2Text->setText(gainText(1));
|
ui->gain2Text->setText(gainText(1));
|
||||||
|
m_settingsKeys.append("gain[1]");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,19 +638,23 @@ void RemoteTCPInputGui::on_gain3_valueChanged(int value)
|
|||||||
} else {
|
} else {
|
||||||
m_settings.m_gain[2] = value * 10;
|
m_settings.m_gain[2] = value * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->gain3Text->setText(gainText(2));
|
ui->gain3Text->setText(gainText(2));
|
||||||
|
m_settingsKeys.append("gain[2]");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_rfBW_changed(int value)
|
void RemoteTCPInputGui::on_rfBW_changed(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_rfBW = value * 1000;
|
m_settings.m_rfBW = value * 1000;
|
||||||
|
m_settingsKeys.append("rfBW");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_deltaFrequency_changed(int value)
|
void RemoteTCPInputGui::on_deltaFrequency_changed(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_inputFrequencyOffset = value;
|
m_settings.m_inputFrequencyOffset = value;
|
||||||
|
m_settingsKeys.append("inputFrequencyOffset");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,21 +662,26 @@ void RemoteTCPInputGui::on_channelGain_valueChanged(int value)
|
|||||||
{
|
{
|
||||||
m_settings.m_channelGain = value;
|
m_settings.m_channelGain = value;
|
||||||
ui->channelGainText->setText(tr("%1dB").arg(m_settings.m_channelGain));
|
ui->channelGainText->setText(tr("%1dB").arg(m_settings.m_channelGain));
|
||||||
|
m_settingsKeys.append("channelGain");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_channelSampleRate_changed(quint64 value)
|
void RemoteTCPInputGui::on_channelSampleRate_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_channelSampleRate = value;
|
m_settings.m_channelSampleRate = value;
|
||||||
|
m_settingsKeys.append("channelSampleRate");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_decimation_toggled(bool checked)
|
void RemoteTCPInputGui::on_decimation_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_channelDecimation = !checked;
|
m_settings.m_channelDecimation = !checked;
|
||||||
|
m_settingsKeys.append("channelDecimation");
|
||||||
|
|
||||||
if (!m_settings.m_channelDecimation)
|
if (!m_settings.m_channelDecimation)
|
||||||
{
|
{
|
||||||
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
m_settings.m_channelSampleRate = m_settings.m_devSampleRate >> m_settings.m_log2Decim;
|
||||||
|
m_settingsKeys.append("channelSampleRate");
|
||||||
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
ui->channelSampleRate->setValue(m_settings.m_channelSampleRate);
|
||||||
}
|
}
|
||||||
ui->channelSampleRate->setEnabled(!checked);
|
ui->channelSampleRate->setEnabled(!checked);
|
||||||
@ -657,12 +691,14 @@ void RemoteTCPInputGui::on_decimation_toggled(bool checked)
|
|||||||
void RemoteTCPInputGui::on_sampleBits_currentIndexChanged(int index)
|
void RemoteTCPInputGui::on_sampleBits_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_sampleBits = 8 * (index + 1);
|
m_settings.m_sampleBits = 8 * (index + 1);
|
||||||
|
m_settingsKeys.append("sampleBits");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputGui::on_dataAddress_editingFinished()
|
void RemoteTCPInputGui::on_dataAddress_editingFinished()
|
||||||
{
|
{
|
||||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||||
|
m_settingsKeys.append("dataAddress");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,6 +713,7 @@ void RemoteTCPInputGui::on_dataPort_editingFinished()
|
|||||||
|
|
||||||
m_settings.m_dataPort = udpPort;
|
m_settings.m_dataPort = udpPort;
|
||||||
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
||||||
|
m_settingsKeys.append("dataPort");
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
@ -684,6 +721,7 @@ void RemoteTCPInputGui::on_dataPort_editingFinished()
|
|||||||
void RemoteTCPInputGui::on_overrideRemoteSettings_toggled(bool checked)
|
void RemoteTCPInputGui::on_overrideRemoteSettings_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_overrideRemoteSettings = checked;
|
m_settings.m_overrideRemoteSettings = checked;
|
||||||
|
m_settingsKeys.append("overrideRemoteSettings");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,6 +729,7 @@ void RemoteTCPInputGui::on_preFill_valueChanged(int value)
|
|||||||
{
|
{
|
||||||
m_settings.m_preFill = value/10.0f;
|
m_settings.m_preFill = value/10.0f;
|
||||||
ui->preFillText->setText(QString("%1s").arg(m_settings.m_preFill, 0, 'f', 2));
|
ui->preFillText->setText(QString("%1s").arg(m_settings.m_preFill, 0, 'f', 2));
|
||||||
|
m_settingsKeys.append("preFill");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,9 +739,10 @@ void RemoteTCPInputGui::updateHardware()
|
|||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInputGui::updateHardware";
|
qDebug() << "RemoteTCPInputGui::updateHardware";
|
||||||
RemoteTCPInput::MsgConfigureRemoteTCPInput* message =
|
RemoteTCPInput::MsgConfigureRemoteTCPInput* message =
|
||||||
RemoteTCPInput::MsgConfigureRemoteTCPInput::create(m_settings, m_forceSettings);
|
RemoteTCPInput::MsgConfigureRemoteTCPInput::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||||
m_sampleSource->getInputMessageQueue()->push(message);
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
m_forceSettings = false;
|
m_forceSettings = false;
|
||||||
|
m_settingsKeys.clear();
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ private:
|
|||||||
Ui::RemoteTCPInputGui* ui;
|
Ui::RemoteTCPInputGui* ui;
|
||||||
|
|
||||||
RemoteTCPInputSettings m_settings; //!< current settings
|
RemoteTCPInputSettings m_settings; //!< current settings
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
RemoteTCPInput* m_sampleSource;
|
RemoteTCPInput* m_sampleSource;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
|
@ -146,3 +146,167 @@ bool RemoteTCPInputSettings::deserialize(const QByteArray& data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteTCPInputSettings::applySettings(const QStringList& settingsKeys, const RemoteTCPInputSettings& settings)
|
||||||
|
{
|
||||||
|
if (settingsKeys.contains("centerFrequency")) {
|
||||||
|
m_centerFrequency = settings.m_centerFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("loPpmCorrection")) {
|
||||||
|
m_loPpmCorrection = settings.m_loPpmCorrection;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dcBlock")) {
|
||||||
|
m_dcBlock = settings.m_dcBlock;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("iqCorrection")) {
|
||||||
|
m_iqCorrection = settings.m_iqCorrection;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("biasTee")) {
|
||||||
|
m_biasTee = settings.m_biasTee;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("directSampling")) {
|
||||||
|
m_directSampling = settings.m_directSampling;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("devSampleRate")) {
|
||||||
|
m_devSampleRate = settings.m_devSampleRate;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("log2Decim")) {
|
||||||
|
m_log2Decim = settings.m_log2Decim;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("agc")) {
|
||||||
|
m_agc = settings.m_agc;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("rfBW")) {
|
||||||
|
m_rfBW = settings.m_rfBW;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("inputFrequencyOffset")) {
|
||||||
|
m_inputFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelGain")) {
|
||||||
|
m_channelGain = settings.m_channelGain;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelSampleRate")) {
|
||||||
|
m_channelSampleRate = settings.m_channelSampleRate;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelDecimation")) {
|
||||||
|
m_channelDecimation = settings.m_channelDecimation;
|
||||||
|
}
|
||||||
|
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("overrideRemoteSettings")) {
|
||||||
|
m_overrideRemoteSettings = settings.m_overrideRemoteSettings;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("preFill")) {
|
||||||
|
m_preFill = settings.m_preFill;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_maxGains; i++)
|
||||||
|
{
|
||||||
|
if (settingsKeys.contains(QString("gain[%1]").arg(i))) {
|
||||||
|
m_gain[i] = settings.m_gain[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RemoteTCPInputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
|
||||||
|
if (settingsKeys.contains("centerFrequency") || force) {
|
||||||
|
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("loPpmCorrection") || force) {
|
||||||
|
ostr << " m_loPpmCorrection: " << m_loPpmCorrection;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dcBlock") || force) {
|
||||||
|
ostr << " m_dcBlock: " << m_dcBlock;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("iqCorrection") || force) {
|
||||||
|
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("biasTee") || force) {
|
||||||
|
ostr << " m_biasTee: " << m_biasTee;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("directSampling") || force) {
|
||||||
|
ostr << " m_directSampling: " << m_directSampling;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("devSampleRate") || force) {
|
||||||
|
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("log2Decim") || force) {
|
||||||
|
ostr << " m_log2Decim: " << m_log2Decim;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("agc") || force) {
|
||||||
|
ostr << " m_agc: " << m_agc;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("rfBW") || force) {
|
||||||
|
ostr << " m_rfBW: " << m_rfBW;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("inputFrequencyOffset") || force) {
|
||||||
|
ostr << " m_inputFrequencyOffset: " << m_inputFrequencyOffset;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelGain") || force) {
|
||||||
|
ostr << " m_channelGain: " << m_channelGain;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelSampleRate") || force) {
|
||||||
|
ostr << " m_channelSampleRate: " << m_channelSampleRate;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelDecimation") || force) {
|
||||||
|
ostr << " m_channelDecimation: " << m_channelDecimation;
|
||||||
|
}
|
||||||
|
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("overrideRemoteSettings") || force) {
|
||||||
|
ostr << " m_overrideRemoteSettings: " << m_overrideRemoteSettings;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("preFill") || force) {
|
||||||
|
ostr << " m_preFill: " << m_preFill;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_maxGains; i++)
|
||||||
|
{
|
||||||
|
if (settingsKeys.contains(QString("gain[%1]").arg(i))) {
|
||||||
|
ostr << QString(" gain[%1]: ").arg(i).toStdString() << m_gain[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString(ostr.str().c_str());
|
||||||
|
}
|
||||||
|
@ -55,6 +55,8 @@ struct RemoteTCPInputSettings
|
|||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
|
void applySettings(const QStringList& settingsKeys, const RemoteTCPInputSettings& settings);
|
||||||
|
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_SAMPLESOURCE_REMOTETCPINPUT_REMOTETCPINPUTSETTINGS_H_ */
|
#endif /* PLUGINS_SAMPLESOURCE_REMOTETCPINPUT_REMOTETCPINPUTSETTINGS_H_ */
|
||||||
|
@ -374,69 +374,66 @@ void RemoteTCPInputTCPHandler::setSampleBitDepth(int sampleBits)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputTCPHandler::applySettings(const RemoteTCPInputSettings& settings, bool force)
|
void RemoteTCPInputTCPHandler::applySettings(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInputTCPHandler::applySettings: "
|
qDebug() << "RemoteTCPInputTCPHandler::applySettings: "
|
||||||
<< "force: " << force
|
<< "force: " << force
|
||||||
<< "m_dataAddress: " << settings.m_dataAddress
|
<< settings.getDebugString(settingsKeys, force);
|
||||||
<< "m_dataPort: " << settings.m_dataPort
|
|
||||||
<< "m_devSampleRate: " << settings.m_devSampleRate
|
|
||||||
<< "m_channelSampleRate: " << settings.m_channelSampleRate;
|
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
if ((settings.m_centerFrequency != m_settings.m_centerFrequency) || force) {
|
if (settingsKeys.contains("centerFrequency") || force) {
|
||||||
setCenterFrequency(settings.m_centerFrequency);
|
setCenterFrequency(settings.m_centerFrequency);
|
||||||
}
|
}
|
||||||
if ((settings.m_loPpmCorrection != m_settings.m_loPpmCorrection) || force) {
|
if (settingsKeys.contains("loPpmCorrection") || force) {
|
||||||
setFreqCorrection(settings.m_loPpmCorrection);
|
setFreqCorrection(settings.m_loPpmCorrection);
|
||||||
}
|
}
|
||||||
if ((settings.m_dcBlock != m_settings.m_dcBlock) || force) {
|
if (settingsKeys.contains("dcBlock") || force) {
|
||||||
setDCOffsetRemoval(settings.m_dcBlock);
|
setDCOffsetRemoval(settings.m_dcBlock);
|
||||||
}
|
}
|
||||||
if ((settings.m_iqCorrection != m_settings.m_iqCorrection) || force) {
|
if (settingsKeys.contains("iqCorrection") || force) {
|
||||||
setIQCorrection(settings.m_iqCorrection);
|
setIQCorrection(settings.m_iqCorrection);
|
||||||
}
|
}
|
||||||
if ((settings.m_biasTee != m_settings.m_biasTee) || force) {
|
if (settingsKeys.contains("biasTee") || force) {
|
||||||
setBiasTee(settings.m_biasTee);
|
setBiasTee(settings.m_biasTee);
|
||||||
}
|
}
|
||||||
if ((settings.m_directSampling != m_settings.m_directSampling) || force) {
|
if (settingsKeys.contains("directSampling") || force) {
|
||||||
setDirectSampling(settings.m_directSampling);
|
setDirectSampling(settings.m_directSampling);
|
||||||
}
|
}
|
||||||
if ((settings.m_log2Decim != m_settings.m_log2Decim) || force) {
|
if (settingsKeys.contains("log2Decim") || force) {
|
||||||
setDecimation(settings.m_log2Decim);
|
setDecimation(settings.m_log2Decim);
|
||||||
}
|
}
|
||||||
if ((settings.m_devSampleRate != m_settings.m_devSampleRate) || force) {
|
if (settingsKeys.contains("devSampleRate") || force) {
|
||||||
setSampleRate(settings.m_devSampleRate);
|
setSampleRate(settings.m_devSampleRate);
|
||||||
}
|
}
|
||||||
if ((settings.m_agc != m_settings.m_agc) || force) {
|
if (settingsKeys.contains("agc") || force) {
|
||||||
setAGC(settings.m_agc);
|
setAGC(settings.m_agc);
|
||||||
}
|
}
|
||||||
if (force) {
|
if (force) {
|
||||||
setTunerAGC(1); // The SDRangel RTLSDR driver always has tuner gain as manual
|
setTunerAGC(1); // The SDRangel RTLSDR driver always has tuner gain as manual
|
||||||
}
|
}
|
||||||
if ((settings.m_gain[0] != m_settings.m_gain[0]) || force) {
|
if (settingsKeys.contains("gain[0]") || force) {
|
||||||
setTunerGain(settings.m_gain[0]);
|
setTunerGain(settings.m_gain[0]);
|
||||||
}
|
}
|
||||||
for (int i = 1; i < 3; i++)
|
for (int i = 1; i < 3; i++)
|
||||||
{
|
{
|
||||||
if ((settings.m_gain[i] != m_settings.m_gain[i]) || force) {
|
if (settingsKeys.contains(QString("gain[%1]").arg(i)) || force) {
|
||||||
//setIFGain(i, 20 + settings.m_gain[i]);
|
//setIFGain(i, 20 + settings.m_gain[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((settings.m_rfBW != m_settings.m_rfBW) || force) {
|
if (settingsKeys.contains("rfBW") || force) {
|
||||||
setBandwidth(settings.m_rfBW);
|
setBandwidth(settings.m_rfBW);
|
||||||
}
|
}
|
||||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
if (settingsKeys.contains("inputFrequencyOffset") || force) {
|
||||||
setChannelFreqOffset(settings.m_inputFrequencyOffset);
|
setChannelFreqOffset(settings.m_inputFrequencyOffset);
|
||||||
}
|
}
|
||||||
if ((settings.m_channelGain != m_settings.m_channelGain) || force) {
|
if (settingsKeys.contains("channelGain") || force) {
|
||||||
setChannelGain(settings.m_channelGain);
|
setChannelGain(settings.m_channelGain);
|
||||||
}
|
}
|
||||||
if ((settings.m_channelSampleRate != m_settings.m_channelSampleRate) || force)
|
if ((settings.m_channelSampleRate != m_settings.m_channelSampleRate) || force)
|
||||||
{
|
{
|
||||||
// Resize FIFO to give us 1 second
|
// Resize FIFO to give us 1 second
|
||||||
// Can't do this while running
|
// Can't do this while running
|
||||||
if (!m_running && settings.m_channelSampleRate > (qint32)m_sampleFifo->size())
|
if (!m_running && settingsKeys.contains("channelSampleRate") && settings.m_channelSampleRate > (qint32)m_sampleFifo->size())
|
||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInputTCPHandler::applySettings: Resizing sample FIFO from " << m_sampleFifo->size() << "to" << settings.m_channelSampleRate;
|
qDebug() << "RemoteTCPInputTCPHandler::applySettings: Resizing sample FIFO from " << m_sampleFifo->size() << "to" << settings.m_channelSampleRate;
|
||||||
m_sampleFifo->setSize(settings.m_channelSampleRate);
|
m_sampleFifo->setSize(settings.m_channelSampleRate);
|
||||||
@ -447,20 +444,24 @@ void RemoteTCPInputTCPHandler::applySettings(const RemoteTCPInputSettings& setti
|
|||||||
setChannelSampleRate(settings.m_channelSampleRate);
|
setChannelSampleRate(settings.m_channelSampleRate);
|
||||||
clearBuffer();
|
clearBuffer();
|
||||||
}
|
}
|
||||||
if ((settings.m_sampleBits != m_settings.m_sampleBits) || force)
|
if (settingsKeys.contains("sampleBits") || force)
|
||||||
{
|
{
|
||||||
setSampleBitDepth(settings.m_sampleBits);
|
setSampleBitDepth(settings.m_sampleBits);
|
||||||
clearBuffer();
|
clearBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't use force, as disconnect can cause rtl_tcp to quit
|
// Don't use force, as disconnect can cause rtl_tcp to quit
|
||||||
if ((settings.m_dataPort != m_settings.m_dataPort) || (settings.m_dataAddress != m_settings.m_dataAddress) || (m_dataSocket == nullptr))
|
if (settingsKeys.contains("dataAddress") || settingsKeys.contains("dataPort") || (m_dataSocket == nullptr))
|
||||||
{
|
{
|
||||||
disconnectFromHost();
|
disconnectFromHost();
|
||||||
connectToHost(settings.m_dataAddress, settings.m_dataPort);
|
connectToHost(settings.m_dataAddress, settings.m_dataPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force) {
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
} else {
|
||||||
|
m_settings.applySettings(settingsKeys, settings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTCPInputTCPHandler::connected()
|
void RemoteTCPInputTCPHandler::connected()
|
||||||
@ -470,7 +471,7 @@ void RemoteTCPInputTCPHandler::connected()
|
|||||||
if (m_settings.m_overrideRemoteSettings)
|
if (m_settings.m_overrideRemoteSettings)
|
||||||
{
|
{
|
||||||
// Force settings to be sent to remote device
|
// Force settings to be sent to remote device
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, QList<QString>(), true);
|
||||||
}
|
}
|
||||||
if (m_messageQueueToGUI)
|
if (m_messageQueueToGUI)
|
||||||
{
|
{
|
||||||
@ -545,11 +546,12 @@ void RemoteTCPInputTCPHandler::dataReadyRead()
|
|||||||
{
|
{
|
||||||
RemoteTCPInputSettings& settings = m_settings;
|
RemoteTCPInputSettings& settings = m_settings;
|
||||||
settings.m_sampleBits = 8;
|
settings.m_sampleBits = 8;
|
||||||
|
QList<QString> settingsKeys{"sampleBits"};
|
||||||
if (m_messageQueueToInput) {
|
if (m_messageQueueToInput) {
|
||||||
m_messageQueueToInput->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings));
|
m_messageQueueToInput->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings, settingsKeys));
|
||||||
}
|
}
|
||||||
if (m_messageQueueToGUI) {
|
if (m_messageQueueToGUI) {
|
||||||
m_messageQueueToGUI->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings));
|
m_messageQueueToGUI->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings, settingsKeys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,32 +567,52 @@ void RemoteTCPInputTCPHandler::dataReadyRead()
|
|||||||
{
|
{
|
||||||
// Update local settings to match remote
|
// Update local settings to match remote
|
||||||
RemoteTCPInputSettings& settings = m_settings;
|
RemoteTCPInputSettings& settings = m_settings;
|
||||||
|
QList<QString> settingsKeys;
|
||||||
settings.m_centerFrequency = RemoteTCPProtocol::extractUInt64(&metaData[8]);
|
settings.m_centerFrequency = RemoteTCPProtocol::extractUInt64(&metaData[8]);
|
||||||
|
settingsKeys.append("centerFrequency");
|
||||||
settings.m_loPpmCorrection = RemoteTCPProtocol::extractUInt32(&metaData[16]);
|
settings.m_loPpmCorrection = RemoteTCPProtocol::extractUInt32(&metaData[16]);
|
||||||
|
settingsKeys.append("loPpmCorrection");
|
||||||
quint32 flags = RemoteTCPProtocol::extractUInt32(&metaData[20]);
|
quint32 flags = RemoteTCPProtocol::extractUInt32(&metaData[20]);
|
||||||
settings.m_biasTee = flags & 1;
|
settings.m_biasTee = flags & 1;
|
||||||
|
settingsKeys.append("biasTee");
|
||||||
settings.m_directSampling = (flags >> 1) & 1;
|
settings.m_directSampling = (flags >> 1) & 1;
|
||||||
|
settingsKeys.append("directSampling");
|
||||||
settings.m_agc = (flags >> 2) & 1;
|
settings.m_agc = (flags >> 2) & 1;
|
||||||
|
settingsKeys.append("agc");
|
||||||
settings.m_dcBlock = (flags >> 3) & 1;
|
settings.m_dcBlock = (flags >> 3) & 1;
|
||||||
|
settingsKeys.append("dcBlock");
|
||||||
settings.m_iqCorrection = (flags >> 4) & 1;
|
settings.m_iqCorrection = (flags >> 4) & 1;
|
||||||
|
settingsKeys.append("iqCorrection");
|
||||||
settings.m_devSampleRate = RemoteTCPProtocol::extractUInt32(&metaData[24]);
|
settings.m_devSampleRate = RemoteTCPProtocol::extractUInt32(&metaData[24]);
|
||||||
|
settingsKeys.append("devSampleRate");
|
||||||
settings.m_log2Decim = RemoteTCPProtocol::extractUInt32(&metaData[28]);
|
settings.m_log2Decim = RemoteTCPProtocol::extractUInt32(&metaData[28]);
|
||||||
|
settingsKeys.append("log2Decim");
|
||||||
settings.m_gain[0] = RemoteTCPProtocol::extractInt16(&metaData[32]);
|
settings.m_gain[0] = RemoteTCPProtocol::extractInt16(&metaData[32]);
|
||||||
settings.m_gain[1] = RemoteTCPProtocol::extractInt16(&metaData[34]);
|
settings.m_gain[1] = RemoteTCPProtocol::extractInt16(&metaData[34]);
|
||||||
settings.m_gain[2] = RemoteTCPProtocol::extractInt16(&metaData[36]);
|
settings.m_gain[2] = RemoteTCPProtocol::extractInt16(&metaData[36]);
|
||||||
|
settingsKeys.append("gain[0]");
|
||||||
|
settingsKeys.append("gain[1]");
|
||||||
|
settingsKeys.append("gain[2]");
|
||||||
settings.m_rfBW = RemoteTCPProtocol::extractUInt32(&metaData[40]);
|
settings.m_rfBW = RemoteTCPProtocol::extractUInt32(&metaData[40]);
|
||||||
|
settingsKeys.append("rfBW");
|
||||||
settings.m_inputFrequencyOffset = RemoteTCPProtocol::extractUInt32(&metaData[44]);
|
settings.m_inputFrequencyOffset = RemoteTCPProtocol::extractUInt32(&metaData[44]);
|
||||||
|
settingsKeys.append("inputFrequencyOffset");
|
||||||
settings.m_channelGain = RemoteTCPProtocol::extractUInt32(&metaData[48]);
|
settings.m_channelGain = RemoteTCPProtocol::extractUInt32(&metaData[48]);
|
||||||
|
settingsKeys.append("channelGain");
|
||||||
settings.m_channelSampleRate = RemoteTCPProtocol::extractUInt32(&metaData[52]);
|
settings.m_channelSampleRate = RemoteTCPProtocol::extractUInt32(&metaData[52]);
|
||||||
|
settingsKeys.append("channelSampleRate");
|
||||||
settings.m_sampleBits = RemoteTCPProtocol::extractUInt32(&metaData[56]);
|
settings.m_sampleBits = RemoteTCPProtocol::extractUInt32(&metaData[56]);
|
||||||
if (settings.m_channelSampleRate != (settings.m_devSampleRate >> settings.m_log2Decim)) {
|
settingsKeys.append("sampleBits");
|
||||||
|
if (settings.m_channelSampleRate != (settings.m_devSampleRate >> settings.m_log2Decim))
|
||||||
|
{
|
||||||
settings.m_channelDecimation = true;
|
settings.m_channelDecimation = true;
|
||||||
|
settingsKeys.append("channelDecimation");
|
||||||
}
|
}
|
||||||
if (m_messageQueueToInput) {
|
if (m_messageQueueToInput) {
|
||||||
m_messageQueueToInput->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings));
|
m_messageQueueToInput->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings, settingsKeys));
|
||||||
}
|
}
|
||||||
if (m_messageQueueToGUI) {
|
if (m_messageQueueToGUI) {
|
||||||
m_messageQueueToGUI->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings));
|
m_messageQueueToGUI->push(RemoteTCPInput::MsgConfigureRemoteTCPInput::create(settings, settingsKeys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -770,7 +792,7 @@ bool RemoteTCPInputTCPHandler::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInputTCPHandler::handleMessage: MsgConfigureTcpHandler";
|
qDebug() << "RemoteTCPInputTCPHandler::handleMessage: MsgConfigureTcpHandler";
|
||||||
MsgConfigureTcpHandler& notif = (MsgConfigureTcpHandler&) cmd;
|
MsgConfigureTcpHandler& notif = (MsgConfigureTcpHandler&) cmd;
|
||||||
applySettings(notif.getSettings(), notif.getForce());
|
applySettings(notif.getSettings(), notif.getSettingsKeys(), notif.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -42,20 +42,23 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const RemoteTCPInputSettings& getSettings() const { return m_settings; }
|
const RemoteTCPInputSettings& getSettings() const { return m_settings; }
|
||||||
|
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureTcpHandler* create(const RemoteTCPInputSettings& settings, bool force)
|
static MsgConfigureTcpHandler* create(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigureTcpHandler(settings, force);
|
return new MsgConfigureTcpHandler(settings, settingsKeys, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RemoteTCPInputSettings m_settings;
|
RemoteTCPInputSettings m_settings;
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureTcpHandler(const RemoteTCPInputSettings& settings, bool force) :
|
MsgConfigureTcpHandler(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
|
m_settingsKeys(settingsKeys),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -165,7 +168,7 @@ private:
|
|||||||
void setChannelFreqOffset(int offset);
|
void setChannelFreqOffset(int offset);
|
||||||
void setChannelGain(int gain);
|
void setChannelGain(int gain);
|
||||||
void setSampleBitDepth(int sampleBits);
|
void setSampleBitDepth(int sampleBits);
|
||||||
void applySettings(const RemoteTCPInputSettings& settings, bool force = false);
|
void applySettings(const RemoteTCPInputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void started();
|
void started();
|
||||||
|
Loading…
Reference in New Issue
Block a user