mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-03 18:18:31 -04:00
Airspy: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
c3f098aee3
commit
1544ea3d46
@ -87,6 +87,7 @@ void AirspyGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -119,7 +120,13 @@ bool AirspyGui::handleMessage(const Message& message)
|
||||
if (AirspyInput::MsgConfigureAirspy::match(message))
|
||||
{
|
||||
const AirspyInput::MsgConfigureAirspy& cfg = (AirspyInput::MsgConfigureAirspy&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
@ -267,6 +274,7 @@ void AirspyGui::sendSettings()
|
||||
void AirspyGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -274,42 +282,49 @@ void AirspyGui::on_LOppm_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_LOppmTenths = value;
|
||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
m_settingsKeys.append("LOppmTenths");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
m_settingsKeys.append("iqCorrection");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_sampleRate_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_devSampleRateIndex = index;
|
||||
m_settingsKeys.append("devSampleRateIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_biasT_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_biasT = (state == Qt::Checked);
|
||||
m_settingsKeys.append("biasT");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_lnaAGC_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_lnaAGC = (state == Qt::Checked);
|
||||
m_settingsKeys.append("lnaAGC");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_mixAGC_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_mixerAGC = (state == Qt::Checked);
|
||||
m_settingsKeys.append("mixerAGC");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -318,6 +333,7 @@ void AirspyGui::on_decim_currentIndexChanged(int index)
|
||||
if ((index <0) || (index > 6))
|
||||
return;
|
||||
m_settings.m_log2Decim = index;
|
||||
m_settingsKeys.append("log2Decim");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -325,12 +341,15 @@ void AirspyGui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
if (index == 0) {
|
||||
m_settings.m_fcPos = AirspySettings::FC_POS_INFRA;
|
||||
m_settingsKeys.append("fcPos");
|
||||
sendSettings();
|
||||
} else if (index == 1) {
|
||||
m_settings.m_fcPos = AirspySettings::FC_POS_SUPRA;
|
||||
m_settingsKeys.append("fcPos");
|
||||
sendSettings();
|
||||
} else if (index == 2) {
|
||||
m_settings.m_fcPos = AirspySettings::FC_POS_CENTER;
|
||||
m_settingsKeys.append("fcPos");
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
@ -342,6 +361,7 @@ void AirspyGui::on_lna_valueChanged(int value)
|
||||
|
||||
ui->lnaGainText->setText(tr("%1dB").arg(value));
|
||||
m_settings.m_lnaGain = value;
|
||||
m_settingsKeys.append("lnaGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -352,6 +372,7 @@ void AirspyGui::on_mix_valueChanged(int value)
|
||||
|
||||
ui->mixText->setText(tr("%1dB").arg(value));
|
||||
m_settings.m_mixerGain = value;
|
||||
m_settingsKeys.append("mixerGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -362,6 +383,7 @@ void AirspyGui::on_vga_valueChanged(int value)
|
||||
|
||||
ui->vgaText->setText(tr("%1dB").arg(value));
|
||||
m_settings.m_vgaGain = value;
|
||||
m_settingsKeys.append("vgaGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -382,14 +404,19 @@ void AirspyGui::on_transverter_clicked()
|
||||
qDebug("AirspyGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
||||
m_settingsKeys.append("transverterMode");
|
||||
m_settingsKeys.append("m_transverterDeltaFrequency");
|
||||
m_settingsKeys.append("m_iqOrder");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::updateHardware()
|
||||
{
|
||||
qDebug() << "AirspyGui::updateHardware";
|
||||
AirspyInput::MsgConfigureAirspy* message = AirspyInput::MsgConfigureAirspy::create(m_settings, m_forceSettings);
|
||||
AirspyInput::MsgConfigureAirspy* message = AirspyInput::MsgConfigureAirspy::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
m_settingsKeys.clear();
|
||||
m_forceSettings = false;
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
@ -466,6 +493,10 @@ void AirspyGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
bool m_doApplySettings;
|
||||
bool m_forceSettings;
|
||||
AirspySettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
std::vector<uint32_t> m_rates;
|
||||
|
@ -170,7 +170,7 @@ bool AirspyInput::openDevice()
|
||||
|
||||
void AirspyInput::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
bool AirspyInput::start()
|
||||
@ -202,7 +202,7 @@ bool AirspyInput::start()
|
||||
m_airspyWorkerThread->start();
|
||||
|
||||
qDebug("AirspyInput::startInput: started");
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return true;
|
||||
@ -257,12 +257,12 @@ bool AirspyInput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureAirspy* message = MsgConfigureAirspy::create(m_settings, true);
|
||||
MsgConfigureAirspy* message = MsgConfigureAirspy::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureAirspy* messageToGUI = MsgConfigureAirspy::create(m_settings, true);
|
||||
MsgConfigureAirspy* messageToGUI = MsgConfigureAirspy::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -290,12 +290,12 @@ void AirspyInput::setCenterFrequency(qint64 centerFrequency)
|
||||
AirspySettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureAirspy* message = MsgConfigureAirspy::create(settings, false);
|
||||
MsgConfigureAirspy* message = MsgConfigureAirspy::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureAirspy* messageToGUI = MsgConfigureAirspy::create(settings, false);
|
||||
MsgConfigureAirspy* messageToGUI = MsgConfigureAirspy::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -307,10 +307,9 @@ bool AirspyInput::handleMessage(const Message& message)
|
||||
MsgConfigureAirspy& conf = (MsgConfigureAirspy&) message;
|
||||
qDebug() << "AirspyInput::handleMessage: MsgConfigureAirspy";
|
||||
|
||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
||||
bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||
|
||||
if (!success)
|
||||
{
|
||||
if (!success) {
|
||||
qDebug("AirspyInput::handleMessage: Airspy config error");
|
||||
}
|
||||
|
||||
@ -323,8 +322,7 @@ bool AirspyInput::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine()) {
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
@ -352,42 +350,32 @@ void AirspyInput::setDeviceCenterFrequency(quint64 freq_hz)
|
||||
|
||||
airspy_error rc = (airspy_error) airspy_set_freq(m_dev, static_cast<uint32_t>(freq_hz));
|
||||
|
||||
if (rc != AIRSPY_SUCCESS)
|
||||
{
|
||||
if (rc != AIRSPY_SUCCESS) {
|
||||
qWarning("AirspyInput::setDeviceCenterFrequency: could not frequency to %llu Hz", freq_hz);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
qDebug("AirspyInput::setDeviceCenterFrequency: frequency set to %llu Hz", freq_hz);
|
||||
}
|
||||
}
|
||||
|
||||
bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
bool AirspyInput::applySettings(const AirspySettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
bool forwardChange = false;
|
||||
airspy_error rc = AIRSPY_ERROR_OTHER;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
qDebug() << "AirspyInput::applySettings";
|
||||
qDebug() << "AirspyInput::applySettings:"
|
||||
<< "force:" << force
|
||||
<< settings.getDebugString(settingsKeys, force);
|
||||
|
||||
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_dcBlock != settings.m_dcBlock) ||
|
||||
(m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
if ((settingsKeys.contains("dcBlock")) ||
|
||||
(settingsKeys.contains("iqCorrection")) || force)
|
||||
{
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
||||
if ((settingsKeys.contains("devSampleRateIndex")) || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRateIndex");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_dev != 0)
|
||||
@ -406,9 +394,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
if ((settingsKeys.contains("log2Decim")) || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_airspyWorker)
|
||||
@ -418,37 +405,19 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
if ((settingsKeys.contains("iqOrder")) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_airspyWorker) {
|
||||
m_airspyWorker->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
}
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force) {
|
||||
reverseAPIKeys.append("fcPos");
|
||||
}
|
||||
if ((m_settings.m_transverterMode != settings.m_transverterMode) || force) {
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
}
|
||||
if ((m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force) {
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
||||
|| (m_settings.m_fcPos != settings.m_fcPos)
|
||||
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force)
|
||||
if ((settingsKeys.contains("centerFrequency"))
|
||||
|| (settingsKeys.contains("transverterDeltaFrequency"))
|
||||
|| (settingsKeys.contains("log2Decim"))
|
||||
|| (settingsKeys.contains("fcPos"))
|
||||
|| (settingsKeys.contains("devSampleRateIndex"))
|
||||
|| (settingsKeys.contains("transverterMode")) || force)
|
||||
{
|
||||
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
|
||||
settings.m_centerFrequency,
|
||||
@ -466,7 +435,7 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
if ((settingsKeys.contains("fcPos")) || force)
|
||||
{
|
||||
if (m_airspyWorker)
|
||||
{
|
||||
@ -475,10 +444,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lnaGain != settings.m_lnaGain) || force)
|
||||
if (settingsKeys.contains("lnaGain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lnaGain");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_lna_gain(m_dev, settings.m_lnaGain);
|
||||
@ -491,10 +458,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lnaAGC != settings.m_lnaAGC) || force)
|
||||
if (settingsKeys.contains("lnaAGC") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lnaAGC");
|
||||
|
||||
if (m_dev != 0) {
|
||||
rc = (airspy_error) airspy_set_lna_agc(m_dev, (settings.m_lnaAGC ? 1 : 0));
|
||||
}
|
||||
@ -506,10 +471,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_mixerGain != settings.m_mixerGain) || force)
|
||||
if (settingsKeys.contains("mixerGain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("mixerGain");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_mixer_gain(m_dev, settings.m_mixerGain);
|
||||
@ -522,10 +485,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_mixerAGC != settings.m_mixerAGC) || force)
|
||||
if (settingsKeys.contains("mixerAGC") || force)
|
||||
{
|
||||
reverseAPIKeys.append("mixerAGC");
|
||||
|
||||
if (m_dev != 0) {
|
||||
rc = (airspy_error) airspy_set_mixer_agc(m_dev, (settings.m_mixerAGC ? 1 : 0));
|
||||
}
|
||||
@ -537,10 +498,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_vgaGain != settings.m_vgaGain) || force)
|
||||
if (settingsKeys.contains("vgaGain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("vgaGain");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_vga_gain(m_dev, settings.m_vgaGain);
|
||||
@ -553,10 +512,8 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_biasT != settings.m_biasT) || force)
|
||||
if (settingsKeys.contains("biasT") || force)
|
||||
{
|
||||
reverseAPIKeys.append("biasT");
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_rf_bias(m_dev, (settings.m_biasT ? 1 : 0));
|
||||
@ -575,10 +532,14 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_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);
|
||||
}
|
||||
|
||||
if (forwardChange)
|
||||
{
|
||||
@ -665,12 +626,12 @@ int AirspyInput::webapiSettingsPutPatch(
|
||||
AirspySettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureAirspy *msg = MsgConfigureAirspy::create(settings, force);
|
||||
MsgConfigureAirspy *msg = MsgConfigureAirspy::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAirspy *msgToGUI = MsgConfigureAirspy::create(settings, force);
|
||||
MsgConfigureAirspy *msgToGUI = MsgConfigureAirspy::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -800,7 +761,7 @@ void AirspyInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respons
|
||||
}
|
||||
}
|
||||
|
||||
void AirspyInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspySettings& settings, bool force)
|
||||
void AirspyInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const AirspySettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(0); // single Rx
|
||||
|
@ -40,20 +40,23 @@ public:
|
||||
|
||||
public:
|
||||
const AirspySettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureAirspy* create(const AirspySettings& settings, bool force)
|
||||
static MsgConfigureAirspy* create(const AirspySettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigureAirspy(settings, force);
|
||||
return new MsgConfigureAirspy(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
AirspySettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureAirspy(const AirspySettings& settings, bool force) :
|
||||
MsgConfigureAirspy(const AirspySettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -148,11 +151,11 @@ private:
|
||||
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
bool applySettings(const AirspySettings& settings, bool force);
|
||||
bool applySettings(const AirspySettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||
struct airspy_device *open_airspy_from_sequence(int sequence);
|
||||
void setDeviceCenterFrequency(quint64 freq);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspySettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const AirspySettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -127,3 +127,135 @@ bool AirspySettings::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AirspySettings::applySettings(const QStringList& settingsKeys, const AirspySettings& 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("fcPos")) {
|
||||
m_fcPos = settings.m_fcPos;
|
||||
}
|
||||
if (settingsKeys.contains("lnaGain")) {
|
||||
m_lnaGain = settings.m_lnaGain;
|
||||
}
|
||||
if (settingsKeys.contains("mixerGain")) {
|
||||
m_mixerGain = settings.m_mixerGain;
|
||||
}
|
||||
if (settingsKeys.contains("vgaGain")) {
|
||||
m_vgaGain = settings.m_vgaGain;
|
||||
}
|
||||
if (settingsKeys.contains("biasT")) {
|
||||
m_biasT = settings.m_biasT;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection")) {
|
||||
m_iqCorrection = settings.m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("lnaAGC")) {
|
||||
m_lnaAGC = settings.m_lnaAGC;
|
||||
}
|
||||
if (settingsKeys.contains("mixerAGC")) {
|
||||
m_mixerAGC = settings.m_mixerAGC;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder")) {
|
||||
m_iqOrder = settings.m_iqOrder;
|
||||
}
|
||||
}
|
||||
|
||||
QString AirspySettings::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("fcPos") || force) {
|
||||
ostr << " m_fcPos: " << m_fcPos;
|
||||
}
|
||||
if (settingsKeys.contains("lnaGain") || force) {
|
||||
ostr << " m_lnaGain: " << m_lnaGain;
|
||||
}
|
||||
if (settingsKeys.contains("mixerGain") || force) {
|
||||
ostr << " m_mixerGain: " << m_mixerGain;
|
||||
}
|
||||
if (settingsKeys.contains("vgaGain") || force) {
|
||||
ostr << " m_vgaGain: " << m_vgaGain;
|
||||
}
|
||||
if (settingsKeys.contains("biasT") || force) {
|
||||
ostr << " m_biasT: " << m_biasT;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection") || force) {
|
||||
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("lnaAGC") || force) {
|
||||
ostr << " m_lnaAGC: " << m_lnaAGC;
|
||||
}
|
||||
if (settingsKeys.contains("mixerAGC") || force) {
|
||||
ostr << " m_mixerAGC: " << m_mixerAGC;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode") || force) {
|
||||
ostr << " m_transverterMode: " << m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder") || force) {
|
||||
ostr << " m_iqOrder: " << m_iqOrder;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ struct AirspySettings {
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const AirspySettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* _AIRSPY_AIRSPYSETTINGS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user