mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 16:01:14 -05:00
Perseus: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
4d8667e716
commit
112d0594b5
@ -84,6 +84,7 @@ void PerseusGui::resetToDefaults()
|
|||||||
{
|
{
|
||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
m_forceSettings = true;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +119,13 @@ bool PerseusGui::handleMessage(const Message& message)
|
|||||||
if (PerseusInput::MsgConfigurePerseus::match(message))
|
if (PerseusInput::MsgConfigurePerseus::match(message))
|
||||||
{
|
{
|
||||||
const PerseusInput::MsgConfigurePerseus& cfg = (PerseusInput::MsgConfigurePerseus&) message;
|
const PerseusInput::MsgConfigurePerseus& cfg = (PerseusInput::MsgConfigurePerseus&) 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);
|
||||||
@ -253,6 +260,7 @@ void PerseusGui::sendSettings()
|
|||||||
void PerseusGui::on_centerFrequency_changed(quint64 value)
|
void PerseusGui::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
m_settings.m_centerFrequency = value * 1000;
|
||||||
|
m_settingsKeys.append("centerFrequency");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +268,7 @@ void PerseusGui::on_LOppm_valueChanged(int value)
|
|||||||
{
|
{
|
||||||
m_settings.m_LOppmTenths = value;
|
m_settings.m_LOppmTenths = value;
|
||||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||||
|
m_settingsKeys.append("LOppmTenths");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,20 +280,25 @@ void PerseusGui::on_resetLOppm_clicked()
|
|||||||
void PerseusGui::on_sampleRate_currentIndexChanged(int index)
|
void PerseusGui::on_sampleRate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRateIndex = index;
|
m_settings.m_devSampleRateIndex = index;
|
||||||
|
m_settingsKeys.append("devSampleRateIndex");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusGui::on_wideband_toggled(bool checked)
|
void PerseusGui::on_wideband_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_wideBand = checked;
|
m_settings.m_wideBand = checked;
|
||||||
|
m_settingsKeys.append("wideBand");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusGui::on_decim_currentIndexChanged(int index)
|
void PerseusGui::on_decim_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index < 0) || (index > 5))
|
if ((index < 0) || (index > 5)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_settings.m_log2Decim = index;
|
m_settings.m_log2Decim = index;
|
||||||
|
m_settingsKeys.append("log2Decim");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +319,10 @@ void PerseusGui::on_transverter_clicked()
|
|||||||
qDebug("PerseusGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
qDebug("PerseusGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||||
updateFrequencyLimits();
|
updateFrequencyLimits();
|
||||||
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
||||||
|
m_settingsKeys.append("transverterMode");
|
||||||
|
m_settingsKeys.append("transverterDeltaFrequency");
|
||||||
|
m_settingsKeys.append("iqOrder");
|
||||||
|
m_settingsKeys.append("centerFrequency");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,28 +331,33 @@ void PerseusGui::on_attenuator_currentIndexChanged(int index)
|
|||||||
if ((index < 0) || (index >= (int) PerseusSettings::Attenuator_last)) {
|
if ((index < 0) || (index >= (int) PerseusSettings::Attenuator_last)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings.m_attenuator = (PerseusSettings::Attenuator) index;
|
m_settings.m_attenuator = (PerseusSettings::Attenuator) index;
|
||||||
|
m_settingsKeys.append("attenuator");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusGui::on_adcDither_toggled(bool checked)
|
void PerseusGui::on_adcDither_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_adcDither = checked;
|
m_settings.m_adcDither = checked;
|
||||||
|
m_settingsKeys.append("adcDither");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusGui::on_adcPreamp_toggled(bool checked)
|
void PerseusGui::on_adcPreamp_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_adcPreamp = checked;
|
m_settings.m_adcPreamp = checked;
|
||||||
|
m_settingsKeys.append("adcPreamp");
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusGui::updateHardware()
|
void PerseusGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "PerseusGui::updateHardware";
|
qDebug() << "PerseusGui::updateHardware";
|
||||||
PerseusInput::MsgConfigurePerseus* message = PerseusInput::MsgConfigurePerseus::create(m_settings, m_forceSettings);
|
PerseusInput::MsgConfigurePerseus* message = PerseusInput::MsgConfigurePerseus::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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ private:
|
|||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
bool m_forceSettings;
|
bool m_forceSettings;
|
||||||
PerseusSettings m_settings;
|
PerseusSettings m_settings;
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<uint32_t> m_rates;
|
std::vector<uint32_t> m_rates;
|
||||||
|
@ -74,7 +74,7 @@ void PerseusInput::destroy()
|
|||||||
|
|
||||||
void PerseusInput::init()
|
void PerseusInput::init()
|
||||||
{
|
{
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, QList<QString>(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerseusInput::start()
|
bool PerseusInput::start()
|
||||||
@ -100,7 +100,7 @@ bool PerseusInput::start()
|
|||||||
m_perseusWorker->setLog2Decimation(m_settings.m_log2Decim);
|
m_perseusWorker->setLog2Decimation(m_settings.m_log2Decim);
|
||||||
m_perseusWorkerThread->start();
|
m_perseusWorkerThread->start();
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, QList<QString>(), true);
|
||||||
m_running = true;
|
m_running = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -141,12 +141,12 @@ bool PerseusInput::deserialize(const QByteArray& data)
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigurePerseus* message = MsgConfigurePerseus::create(m_settings, true);
|
MsgConfigurePerseus* message = MsgConfigurePerseus::create(m_settings, QList<QString>(), true);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigurePerseus* messageToGUI = MsgConfigurePerseus::create(m_settings, true);
|
MsgConfigurePerseus* messageToGUI = MsgConfigurePerseus::create(m_settings, QList<QString>(), true);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,12 +176,12 @@ void PerseusInput::setCenterFrequency(qint64 centerFrequency)
|
|||||||
PerseusSettings settings = m_settings;
|
PerseusSettings settings = m_settings;
|
||||||
settings.m_centerFrequency = centerFrequency;
|
settings.m_centerFrequency = centerFrequency;
|
||||||
|
|
||||||
MsgConfigurePerseus* message = MsgConfigurePerseus::create(settings, false);
|
MsgConfigurePerseus* message = MsgConfigurePerseus::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigurePerseus* messageToGUI = MsgConfigurePerseus::create(settings, false);
|
MsgConfigurePerseus* messageToGUI = MsgConfigurePerseus::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ bool PerseusInput::handleMessage(const Message& message)
|
|||||||
MsgConfigurePerseus& conf = (MsgConfigurePerseus&) message;
|
MsgConfigurePerseus& conf = (MsgConfigurePerseus&) message;
|
||||||
qDebug() << "PerseusInput::handleMessage: MsgConfigurePerseus";
|
qDebug() << "PerseusInput::handleMessage: MsgConfigurePerseus";
|
||||||
|
|
||||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qDebug("MsgConfigurePerseus::handleMessage: Perseus config error");
|
qDebug("MsgConfigurePerseus::handleMessage: Perseus config error");
|
||||||
@ -208,8 +208,7 @@ bool PerseusInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if (cmd.getStartStop())
|
if (cmd.getStartStop())
|
||||||
{
|
{
|
||||||
if (m_deviceAPI->initDeviceEngine())
|
if (m_deviceAPI->initDeviceEngine()) {
|
||||||
{
|
|
||||||
m_deviceAPI->startDeviceEngine();
|
m_deviceAPI->startDeviceEngine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,15 +295,14 @@ void PerseusInput::setDeviceCenterFrequency(quint64 freq_hz, const PerseusSettin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
bool PerseusInput::applySettings(const PerseusSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
|
qDebug() << "PerseusInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
int sampleRateIndex = settings.m_devSampleRateIndex;
|
int sampleRateIndex = settings.m_devSampleRateIndex;
|
||||||
QList<QString> reverseAPIKeys;
|
|
||||||
|
|
||||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
if (settingsKeys.contains("devSampleRateIndex") || force)
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("devSampleRateIndex");
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
||||||
@ -334,9 +332,8 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
if (settingsKeys.contains("log2Decim") || force)
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("log2Decim");
|
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_running)
|
if (m_running)
|
||||||
@ -346,37 +343,19 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
if (settingsKeys.contains("iqOrder") || force)
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("iqOrder");
|
|
||||||
|
|
||||||
if (m_running) {
|
if (m_running) {
|
||||||
m_perseusWorker->setIQOrder(settings.m_iqOrder);
|
m_perseusWorker->setIQOrder(settings.m_iqOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
|
if (force || settingsKeys.contains("centerFrequency")
|
||||||
reverseAPIKeys.append("centerFrequency");
|
|| settingsKeys.contains("LOppmTenths")
|
||||||
}
|
|| settingsKeys.contains("wideBand")
|
||||||
if (force || (m_settings.m_LOppmTenths != settings.m_LOppmTenths)) {
|
|| settingsKeys.contains("transverterMode")
|
||||||
reverseAPIKeys.append("LOppmTenths");
|
|| settingsKeys.contains("transverterDeltaFrequency")
|
||||||
}
|
|| settingsKeys.contains("devSampleRateIndex"))
|
||||||
if (force || (m_settings.m_wideBand != settings.m_wideBand)) {
|
|
||||||
reverseAPIKeys.append("wideBand");
|
|
||||||
}
|
|
||||||
if (force || (m_settings.m_transverterMode != settings.m_transverterMode)) {
|
|
||||||
reverseAPIKeys.append("transverterMode");
|
|
||||||
}
|
|
||||||
if (force || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)) {
|
|
||||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|
|
||||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
|
||||||
|| (m_settings.m_wideBand != settings.m_wideBand)
|
|
||||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
|
||||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
|
||||||
|| (m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex))
|
|
||||||
{
|
{
|
||||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||||
@ -391,9 +370,8 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_settings.m_attenuator != settings.m_attenuator) || force)
|
if (settingsKeys.contains("attenuator") || force)
|
||||||
{
|
{
|
||||||
reverseAPIKeys.append("attenuator");
|
|
||||||
int rc = perseus_set_attenuator_n(m_perseusDescriptor, (int) settings.m_attenuator);
|
int rc = perseus_set_attenuator_n(m_perseusDescriptor, (int) settings.m_attenuator);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@ -403,15 +381,8 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force || (m_settings.m_adcDither != settings.m_adcDither)) {
|
if (settingsKeys.contains("adcDither")
|
||||||
reverseAPIKeys.append("adcDither");
|
|| settingsKeys.contains("adcPreamp") || force)
|
||||||
}
|
|
||||||
if (force || (m_settings.m_adcPreamp != settings.m_adcPreamp)) {
|
|
||||||
reverseAPIKeys.append("adcPreamp");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_settings.m_adcDither != settings.m_adcDither)
|
|
||||||
|| (m_settings.m_adcPreamp != settings.m_adcPreamp) || force)
|
|
||||||
{
|
{
|
||||||
int rc = perseus_set_adc(m_perseusDescriptor, settings.m_adcDither ? 1 : 0, settings.m_adcPreamp ? 1 : 0);
|
int rc = perseus_set_adc(m_perseusDescriptor, settings.m_adcDither ? 1 : 0, settings.m_adcPreamp ? 1 : 0);
|
||||||
|
|
||||||
@ -431,29 +402,22 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (force) {
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
} else {
|
||||||
|
m_settings.applySettings(settingsKeys, settings);
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "PerseusInput::applySettings: "
|
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
||||||
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
|
|
||||||
<< " m_devSampleRateIndex: " << m_settings.m_devSampleRateIndex
|
|
||||||
<< " m_log2Decim: " << m_settings.m_log2Decim
|
|
||||||
<< " m_iqOrder: " << m_settings.m_iqOrder
|
|
||||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
|
||||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
|
||||||
<< " m_adcDither: " << m_settings.m_adcDither
|
|
||||||
<< " m_adcPreamp: " << m_settings.m_adcPreamp
|
|
||||||
<< " m_wideBand: " << m_settings.m_wideBand
|
|
||||||
<< " m_attenuator: " << m_settings.m_attenuator;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -507,12 +471,12 @@ int PerseusInput::webapiSettingsPutPatch(
|
|||||||
PerseusSettings settings = m_settings;
|
PerseusSettings settings = m_settings;
|
||||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||||
|
|
||||||
MsgConfigurePerseus *msg = MsgConfigurePerseus::create(settings, force);
|
MsgConfigurePerseus *msg = MsgConfigurePerseus::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
|
||||||
{
|
{
|
||||||
MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, force);
|
MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, deviceSettingsKeys, force);
|
||||||
m_guiMessageQueue->push(msgToGUI);
|
m_guiMessageQueue->push(msgToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,7 +586,7 @@ void PerseusInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force)
|
void PerseusInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PerseusSettings& 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
|
||||||
|
@ -42,20 +42,23 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const PerseusSettings& getSettings() const { return m_settings; }
|
const PerseusSettings& 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 MsgConfigurePerseus* create(const PerseusSettings& settings, bool force)
|
static MsgConfigurePerseus* create(const PerseusSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigurePerseus(settings, force);
|
return new MsgConfigurePerseus(settings, settingsKeys, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PerseusSettings m_settings;
|
PerseusSettings m_settings;
|
||||||
|
QList<QString> m_settingsKeys;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigurePerseus(const PerseusSettings& settings, bool force) :
|
MsgConfigurePerseus(const PerseusSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
|
m_settingsKeys(settingsKeys),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -149,9 +152,9 @@ private:
|
|||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
void setDeviceCenterFrequency(quint64 freq, const PerseusSettings& settings);
|
void setDeviceCenterFrequency(quint64 freq, const PerseusSettings& settings);
|
||||||
bool applySettings(const PerseusSettings& settings, bool force = false);
|
bool applySettings(const PerseusSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force);
|
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force);
|
||||||
void webapiReverseSendStartStop(bool start);
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -119,3 +119,104 @@ bool PerseusSettings::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerseusSettings::applySettings(const QStringList& settingsKeys, const PerseusSettings& settings)
|
||||||
|
{
|
||||||
|
if (settingsKeys.contains("centerFrequency")) {
|
||||||
|
m_centerFrequency = settings.m_centerFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("LOppmTenths")) {
|
||||||
|
m_LOppmTenths = settings.m_LOppmTenths;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("devSampleRateIndex")) {
|
||||||
|
m_devSampleRateIndex = settings.m_devSampleRateIndex;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("log2Decim")) {
|
||||||
|
m_log2Decim = settings.m_log2Decim;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterMode")) {
|
||||||
|
m_transverterMode = settings.m_transverterMode;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||||
|
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("iqOrder")) {
|
||||||
|
m_iqOrder = settings.m_iqOrder;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("adcDither")) {
|
||||||
|
m_adcDither = settings.m_adcDither;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("adcPreamp")) {
|
||||||
|
m_adcPreamp = settings.m_adcPreamp;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("wideBand")) {
|
||||||
|
m_wideBand = settings.m_wideBand;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("attenuator")) {
|
||||||
|
m_attenuator = settings.m_attenuator;
|
||||||
|
}
|
||||||
|
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 PerseusSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
|
||||||
|
if (settingsKeys.contains("centerFrequency") || force) {
|
||||||
|
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||||
|
ostr << " m_LOppmTenths: " << m_LOppmTenths;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("devSampleRateIndex") || force) {
|
||||||
|
ostr << " m_devSampleRateIndex: " << m_devSampleRateIndex;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("log2Decim") || force) {
|
||||||
|
ostr << " m_log2Decim: " << m_log2Decim;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterMode") || force) {
|
||||||
|
ostr << " m_transverterMode: " << m_transverterMode;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||||
|
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("iqOrder") || force) {
|
||||||
|
ostr << " m_iqOrder: " << m_iqOrder;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("adcDither") || force) {
|
||||||
|
ostr << " m_adcDither: " << m_adcDither;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("adcPreamp") || force) {
|
||||||
|
ostr << " m_adcPreamp: " << m_adcPreamp;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("wideBand") || force) {
|
||||||
|
ostr << " m_wideBand: " << m_wideBand;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("attenuator") || force) {
|
||||||
|
ostr << " m_attenuator: " << m_attenuator;
|
||||||
|
}
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
@ -52,6 +52,8 @@ struct PerseusSettings
|
|||||||
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 PerseusSettings& settings);
|
||||||
|
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user