mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-12 18:52:25 -04:00
Remote output: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
79b174bf36
commit
caf60d2ea6
@ -117,7 +117,7 @@ bool RemoteOutput::start()
|
|||||||
|
|
||||||
void RemoteOutput::init()
|
void RemoteOutput::init()
|
||||||
{
|
{
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, QList<QString>(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutput::stop()
|
void RemoteOutput::stop()
|
||||||
@ -161,12 +161,12 @@ bool RemoteOutput::deserialize(const QByteArray& data)
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureRemoteOutput* message = MsgConfigureRemoteOutput::create(m_settings, true);
|
MsgConfigureRemoteOutput* message = MsgConfigureRemoteOutput::create(m_settings, QList<QString>(), true);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteOutput* messageToGUI = MsgConfigureRemoteOutput::create(m_settings, true);
|
MsgConfigureRemoteOutput* messageToGUI = MsgConfigureRemoteOutput::create(m_settings, QList<QString>(), true);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ bool RemoteOutput::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
qDebug() << "RemoteOutput::handleMessage:" << message.getIdentifier();
|
qDebug() << "RemoteOutput::handleMessage:" << message.getIdentifier();
|
||||||
MsgConfigureRemoteOutput& conf = (MsgConfigureRemoteOutput&) message;
|
MsgConfigureRemoteOutput& conf = (MsgConfigureRemoteOutput&) message;
|
||||||
applySettings(conf.getSettings(), conf.getForce());
|
applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgConfigureRemoteOutputWork::match(message))
|
else if (MsgConfigureRemoteOutputWork::match(message))
|
||||||
@ -270,44 +270,29 @@ bool RemoteOutput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool force)
|
void RemoteOutput::applySettings(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
|
qDebug() << "RemoteOutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
QList<QString> reverseAPIKeys;
|
|
||||||
|
|
||||||
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) {
|
if (force ||
|
||||||
reverseAPIKeys.append("dataAddress");
|
settingsKeys.contains("dataAddress") ||
|
||||||
}
|
settingsKeys.contains("dataPort"))
|
||||||
if ((m_settings.m_dataPort != settings.m_dataPort) || force) {
|
|
||||||
reverseAPIKeys.append("dataPort");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_apiAddress != settings.m_apiAddress) || force) {
|
|
||||||
reverseAPIKeys.append("apiAddress");
|
|
||||||
}
|
|
||||||
if ((m_settings.m_apiPort != settings.m_apiPort) || force) {
|
|
||||||
reverseAPIKeys.append("apiPort");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (force || (m_settings.m_dataAddress != settings.m_dataAddress) || (m_settings.m_dataPort != settings.m_dataPort))
|
|
||||||
{
|
{
|
||||||
if (m_remoteOutputWorker) {
|
if (m_remoteOutputWorker) {
|
||||||
m_remoteOutputWorker->setDataAddress(settings.m_dataAddress, settings.m_dataPort);
|
m_remoteOutputWorker->setDataAddress(settings.m_dataAddress, settings.m_dataPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks))
|
if (force || settingsKeys.contains("nbFECBlocks"))
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("nbFECBlocks");
|
|
||||||
|
|
||||||
if (m_remoteOutputWorker) {
|
if (m_remoteOutputWorker) {
|
||||||
m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks);
|
m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || (m_settings.m_nbTxBytes != settings.m_nbTxBytes))
|
if (force || settingsKeys.contains("nbTxBytes"))
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("nbTxBytes");
|
|
||||||
|
|
||||||
if (m_remoteOutputWorker)
|
if (m_remoteOutputWorker)
|
||||||
{
|
{
|
||||||
stopWorker();
|
stopWorker();
|
||||||
@ -318,24 +303,20 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc
|
|||||||
|
|
||||||
mutexLocker.unlock();
|
mutexLocker.unlock();
|
||||||
|
|
||||||
qDebug() << "RemoteOutput::applySettings:"
|
if (settingsKeys.contains("useReverseAPI"))
|
||||||
<< " m_nbFECBlocks: " << settings.m_nbFECBlocks
|
|
||||||
<< " m_nbTxBytes: " << settings.m_nbTxBytes
|
|
||||||
<< " m_apiAddress: " << settings.m_apiAddress
|
|
||||||
<< " m_apiPort: " << settings.m_apiPort
|
|
||||||
<< " m_dataAddress: " << settings.m_dataAddress
|
|
||||||
<< " m_dataPort: " << settings.m_dataPort;
|
|
||||||
|
|
||||||
if (settings.m_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings = settings;
|
if (force) {
|
||||||
|
m_settings = settings;
|
||||||
|
} else {
|
||||||
|
m_settings.applySettings(settingsKeys, settings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutput::applyCenterFrequency()
|
void RemoteOutput::applyCenterFrequency()
|
||||||
@ -407,12 +388,12 @@ int RemoteOutput::webapiSettingsPutPatch(
|
|||||||
RemoteOutputSettings settings = m_settings;
|
RemoteOutputSettings settings = m_settings;
|
||||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
MsgConfigureRemoteOutput *msg = MsgConfigureRemoteOutput::create(settings, force);
|
MsgConfigureRemoteOutput *msg = MsgConfigureRemoteOutput::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
|
||||||
{
|
{
|
||||||
MsgConfigureRemoteOutput *msgToGUI = MsgConfigureRemoteOutput::create(settings, force);
|
MsgConfigureRemoteOutput *msgToGUI = MsgConfigureRemoteOutput::create(settings, deviceSettingsKeys, force);
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +652,7 @@ void RemoteOutput::queueLengthCompensation(
|
|||||||
getInputMessageQueue()->push(message);
|
getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force)
|
void RemoteOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
swgDeviceSettings->setDirection(1); // single Tx
|
swgDeviceSettings->setDirection(1); // single Tx
|
||||||
|
@ -46,20 +46,22 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const RemoteOutputSettings& getSettings() const { return m_settings; }
|
const RemoteOutputSettings& 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 MsgConfigureRemoteOutput* create(const RemoteOutputSettings& settings, bool force = false)
|
static MsgConfigureRemoteOutput* create(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force = false) {
|
||||||
{
|
return new MsgConfigureRemoteOutput(settings, settingsKeys, force);
|
||||||
return new MsgConfigureRemoteOutput(settings, force);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RemoteOutputSettings m_settings;
|
RemoteOutputSettings m_settings;
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureRemoteOutput(const RemoteOutputSettings& settings, bool force) :
|
MsgConfigureRemoteOutput(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
|
m_settingsKeys(settingsKeys),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -275,7 +277,7 @@ private:
|
|||||||
|
|
||||||
void startWorker();
|
void startWorker();
|
||||||
void stopWorker();
|
void stopWorker();
|
||||||
void applySettings(const RemoteOutputSettings& settings, bool force = false);
|
void applySettings(const RemoteOutputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||||
void applyCenterFrequency();
|
void applyCenterFrequency();
|
||||||
void applySampleRate();
|
void applySampleRate();
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
@ -286,7 +288,7 @@ private:
|
|||||||
int queueLength,
|
int queueLength,
|
||||||
int queueSize
|
int queueSize
|
||||||
);
|
);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteOutputSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -117,6 +117,7 @@ void RemoteOutputSinkGui::resetToDefaults()
|
|||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
|
m_forceSettings = true;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +156,13 @@ bool RemoteOutputSinkGui::handleMessage(const Message& message)
|
|||||||
if (RemoteOutput::MsgConfigureRemoteOutput::match(message))
|
if (RemoteOutput::MsgConfigureRemoteOutput::match(message))
|
||||||
{
|
{
|
||||||
const RemoteOutput::MsgConfigureRemoteOutput& cfg = (RemoteOutput::MsgConfigureRemoteOutput&) message;
|
const RemoteOutput::MsgConfigureRemoteOutput& cfg = (RemoteOutput::MsgConfigureRemoteOutput&) message;
|
||||||
m_settings = cfg.getSettings();
|
|
||||||
|
if (cfg.getForce()) {
|
||||||
|
m_settings = cfg.getSettings();
|
||||||
|
} else {
|
||||||
|
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||||
|
}
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -239,17 +246,19 @@ void RemoteOutputSinkGui::displaySettings()
|
|||||||
|
|
||||||
void RemoteOutputSinkGui::sendSettings()
|
void RemoteOutputSinkGui::sendSettings()
|
||||||
{
|
{
|
||||||
if(!m_updateTimer.isActive())
|
if (!m_updateTimer.isActive()) {
|
||||||
m_updateTimer.start(100);
|
m_updateTimer.start(100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RemoteOutputSinkGui::updateHardware()
|
void RemoteOutputSinkGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "RemoteOutputSinkGui::updateHardware";
|
qDebug() << "RemoteOutputSinkGui::updateHardware";
|
||||||
RemoteOutput::MsgConfigureRemoteOutput* message = RemoteOutput::MsgConfigureRemoteOutput::create(m_settings, m_forceSettings);
|
RemoteOutput::MsgConfigureRemoteOutput* message = RemoteOutput::MsgConfigureRemoteOutput::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||||
m_remoteOutput->getInputMessageQueue()->push(message);
|
m_remoteOutput->getInputMessageQueue()->push(message);
|
||||||
m_forceSettings = false;
|
m_forceSettings = false;
|
||||||
|
m_settingsKeys.clear();
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,6 +299,7 @@ void RemoteOutputSinkGui::on_nbFECBlocks_valueChanged(int value)
|
|||||||
QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0);
|
QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0);
|
||||||
QString s1 = QString::number(nbFECBlocks, 'f', 0);
|
QString s1 = QString::number(nbFECBlocks, 'f', 0);
|
||||||
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
|
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
|
||||||
|
m_settingsKeys.append("nbFECBlocks");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +314,7 @@ void RemoteOutputSinkGui::on_deviceIndex_returnPressed()
|
|||||||
m_settings.m_deviceIndex = deviceIndex;
|
m_settings.m_deviceIndex = deviceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_settingsKeys.append("deviceIndex");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,18 +329,21 @@ void RemoteOutputSinkGui::on_channelIndex_returnPressed()
|
|||||||
m_settings.m_channelIndex = channelIndex;
|
m_settings.m_channelIndex = channelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_settingsKeys.append("channelIndex");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutputSinkGui::on_nbTxBytes_currentIndexChanged(int index)
|
void RemoteOutputSinkGui::on_nbTxBytes_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_nbTxBytes = 1 << index;
|
m_settings.m_nbTxBytes = 1 << index;
|
||||||
|
m_settingsKeys.append("nbTxBytes");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteOutputSinkGui::on_apiAddress_returnPressed()
|
void RemoteOutputSinkGui::on_apiAddress_returnPressed()
|
||||||
{
|
{
|
||||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||||
|
m_settingsKeys.append("apiAddress");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
|
|
||||||
RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create();
|
RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create();
|
||||||
@ -347,6 +361,7 @@ void RemoteOutputSinkGui::on_apiPort_returnPressed()
|
|||||||
m_settings.m_apiPort = apiPort;
|
m_settings.m_apiPort = apiPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_settingsKeys.append("apiPort");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
|
|
||||||
RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create();
|
RemoteOutput::MsgRequestFixedData *msg = RemoteOutput::MsgRequestFixedData::create();
|
||||||
@ -356,6 +371,7 @@ void RemoteOutputSinkGui::on_apiPort_returnPressed()
|
|||||||
void RemoteOutputSinkGui::on_dataAddress_returnPressed()
|
void RemoteOutputSinkGui::on_dataAddress_returnPressed()
|
||||||
{
|
{
|
||||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||||
|
m_settingsKeys.append("dataAddress");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +386,7 @@ void RemoteOutputSinkGui::on_dataPort_returnPressed()
|
|||||||
m_settings.m_dataPort = dataPort;
|
m_settings.m_dataPort = dataPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_settingsKeys.append("dataPort");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,6 +394,7 @@ void RemoteOutputSinkGui::on_apiApplyButton_clicked(bool checked)
|
|||||||
{
|
{
|
||||||
(void) checked;
|
(void) checked;
|
||||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||||
|
m_settingsKeys.append("apiAddress");
|
||||||
|
|
||||||
bool apiOk;
|
bool apiOk;
|
||||||
int apiPort = ui->apiPort->text().toInt(&apiOk);
|
int apiPort = ui->apiPort->text().toInt(&apiOk);
|
||||||
@ -384,6 +402,7 @@ void RemoteOutputSinkGui::on_apiApplyButton_clicked(bool checked)
|
|||||||
if((apiOk) && (apiPort >= 1024) && (apiPort < 65535))
|
if((apiOk) && (apiPort >= 1024) && (apiPort < 65535))
|
||||||
{
|
{
|
||||||
m_settings.m_apiPort = apiPort;
|
m_settings.m_apiPort = apiPort;
|
||||||
|
m_settingsKeys.append("apiPort");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
@ -396,6 +415,7 @@ void RemoteOutputSinkGui::on_dataApplyButton_clicked(bool checked)
|
|||||||
{
|
{
|
||||||
(void) checked;
|
(void) checked;
|
||||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||||
|
m_settingsKeys.append("dataAddress");
|
||||||
|
|
||||||
bool dataOk;
|
bool dataOk;
|
||||||
int udpDataPort = ui->dataPort->text().toInt(&dataOk);
|
int udpDataPort = ui->dataPort->text().toInt(&dataOk);
|
||||||
@ -403,6 +423,7 @@ void RemoteOutputSinkGui::on_dataApplyButton_clicked(bool checked)
|
|||||||
if((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535))
|
if((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535))
|
||||||
{
|
{
|
||||||
m_settings.m_dataPort = udpDataPort;
|
m_settings.m_dataPort = udpDataPort;
|
||||||
|
m_settingsKeys.append("dataPort");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
@ -551,6 +572,10 @@ void RemoteOutputSinkGui::openDeviceSettingsDialog(const QPoint& p)
|
|||||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||||
|
m_settingsKeys.append("useReverseAPI");
|
||||||
|
m_settingsKeys.append("reverseAPIAddress");
|
||||||
|
m_settingsKeys.append("reverseAPIPort");
|
||||||
|
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ private:
|
|||||||
Ui::RemoteOutputGui* ui;
|
Ui::RemoteOutputGui* ui;
|
||||||
|
|
||||||
RemoteOutputSettings m_settings; //!< current settings
|
RemoteOutputSettings m_settings; //!< current settings
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
RemoteOutputSettings m_controlSettings; //!< settings last sent to device via control port
|
RemoteOutputSettings m_controlSettings; //!< settings last sent to device via control port
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
|
@ -104,3 +104,88 @@ bool RemoteOutputSettings::deserialize(const QByteArray& data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteOutputSettings::applySettings(const QStringList& settingsKeys, const RemoteOutputSettings& settings)
|
||||||
|
{
|
||||||
|
if (settingsKeys.contains("nbFECBlocks")) {
|
||||||
|
m_nbFECBlocks = settings.m_nbFECBlocks;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("nbTxBytes")) {
|
||||||
|
m_nbTxBytes = settings.m_nbTxBytes;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("apiAddress")) {
|
||||||
|
m_apiAddress = settings.m_apiAddress;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("apiPort")) {
|
||||||
|
m_apiPort = settings.m_apiPort;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dataAddress")) {
|
||||||
|
m_dataAddress = settings.m_dataAddress;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dataPort")) {
|
||||||
|
m_dataPort = settings.m_dataPort;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("deviceIndex")) {
|
||||||
|
m_deviceIndex = settings.m_deviceIndex;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelIndex")) {
|
||||||
|
m_channelIndex = settings.m_channelIndex;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RemoteOutputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
|
||||||
|
if (settingsKeys.contains("nbFECBlocks") || force) {
|
||||||
|
ostr << " m_nbFECBlocks: " << m_nbFECBlocks;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("nbTxBytes") || force) {
|
||||||
|
ostr << " m_nbTxBytes: " << m_nbTxBytes;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("apiAddress") || force) {
|
||||||
|
ostr << " m_apiAddress: " << m_apiAddress.toStdString();
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("apiPort") || force) {
|
||||||
|
ostr << " m_apiPort: " << m_apiPort;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dataAddress") || force) {
|
||||||
|
ostr << " m_dataAddress: " << m_dataAddress.toStdString();
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("dataPort") || force) {
|
||||||
|
ostr << " m_dataPort: " << m_dataPort;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("deviceIndex") || force) {
|
||||||
|
ostr << " m_deviceIndex: " << m_deviceIndex;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("channelIndex") || force) {
|
||||||
|
ostr << " m_channelIndex: " << m_channelIndex;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString(ostr.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ struct RemoteOutputSettings {
|
|||||||
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 RemoteOutputSettings& settings);
|
||||||
|
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_REMOTEOUTPUT_REMOTEOUTPUTSETTINGS_H_ */
|
#endif /* PLUGINS_REMOTEOUTPUT_REMOTEOUTPUTSETTINGS_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user