mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
AirspyHF: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
1544ea3d46
commit
f9abe865b1
@ -86,6 +86,7 @@ void AirspyHFGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -96,7 +97,7 @@ QByteArray AirspyHFGui::serialize() const
|
||||
|
||||
bool AirspyHFGui::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data)) {
|
||||
if (m_settings.deserialize(data)) {
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
@ -118,7 +119,13 @@ bool AirspyHFGui::handleMessage(const Message& message)
|
||||
if (AirspyHFInput::MsgConfigureAirspyHF::match(message))
|
||||
{
|
||||
const AirspyHFInput::MsgConfigureAirspyHF& cfg = (AirspyHFInput::MsgConfigureAirspyHF&) 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);
|
||||
@ -288,6 +295,7 @@ void AirspyHFGui::sendSettings()
|
||||
void AirspyHFGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -295,6 +303,7 @@ void AirspyHFGui::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();
|
||||
}
|
||||
|
||||
@ -305,15 +314,19 @@ void AirspyHFGui::on_resetLOppm_clicked()
|
||||
|
||||
void AirspyHFGui::on_sampleRate_currentIndexChanged(int index)
|
||||
{
|
||||
m_settingsKeys.append("devSampleRateIndex");
|
||||
m_settings.m_devSampleRateIndex = index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyHFGui::on_decim_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index < 0) || (index > 8))
|
||||
if ((index < 0) || (index > 8)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.m_log2Decim = index;
|
||||
m_settingsKeys.append("log2Decim");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -334,6 +347,10 @@ void AirspyHFGui::on_transverter_clicked()
|
||||
qDebug("AirspyHFGui::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("transverterDeltaFrequency");
|
||||
m_settingsKeys.append("iqOrder");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -347,18 +364,22 @@ void AirspyHFGui::on_band_currentIndexChanged(int index)
|
||||
updateFrequencyLimits();
|
||||
qDebug("AirspyHFGui::on_band_currentIndexChanged: freq: %llu", ui->centerFrequency->getValueNew() * 1000);
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew() * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
m_settingsKeys.append("bandIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyHFGui::on_dsp_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_useDSP = checked;
|
||||
m_settingsKeys.append("useDSP");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyHFGui::on_lna_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_useLNA = checked;
|
||||
m_settingsKeys.append("useLNA");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -367,16 +388,23 @@ void AirspyHFGui::on_agc_currentIndexChanged(int index)
|
||||
if (index == 0)
|
||||
{
|
||||
m_settings.m_useAGC = false;
|
||||
m_settingsKeys.append("useAGC");
|
||||
sendSettings();
|
||||
}
|
||||
else if (index <= 2)
|
||||
{
|
||||
m_settings.m_useAGC = true;
|
||||
m_settingsKeys.append("useAGC");
|
||||
|
||||
if (index == 1) {
|
||||
if (index == 1)
|
||||
{
|
||||
m_settings.m_agcHigh = false;
|
||||
} else {
|
||||
m_settingsKeys.append("agcHigh");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.m_agcHigh = true;
|
||||
m_settingsKeys.append("agcHigh");
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
@ -388,6 +416,7 @@ void AirspyHFGui::on_att_currentIndexChanged(int index)
|
||||
if ((index >= 0) && (index <= 8))
|
||||
{
|
||||
m_settings.m_attenuatorSteps = index;
|
||||
m_settingsKeys.append("attenuatorSteps");
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
@ -395,20 +424,23 @@ void AirspyHFGui::on_att_currentIndexChanged(int index)
|
||||
void AirspyHFGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyHFGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
m_settingsKeys.append("iqCorrection");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyHFGui::updateHardware()
|
||||
{
|
||||
qDebug() << "AirspyHFGui::updateHardware";
|
||||
AirspyHFInput::MsgConfigureAirspyHF* message = AirspyHFInput::MsgConfigureAirspyHF::create(m_settings, m_forceSettings);
|
||||
AirspyHFInput::MsgConfigureAirspyHF* message = AirspyHFInput::MsgConfigureAirspyHF::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
m_settingsKeys.clear();
|
||||
m_forceSettings = false;
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
@ -484,6 +516,10 @@ void AirspyHFGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
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();
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ private:
|
||||
bool m_doApplySettings;
|
||||
bool m_forceSettings;
|
||||
AirspyHFSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
std::vector<uint32_t> m_rates;
|
||||
|
@ -160,7 +160,7 @@ bool AirspyHFInput::openDevice()
|
||||
|
||||
void AirspyHFInput::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
bool AirspyHFInput::start()
|
||||
@ -199,7 +199,7 @@ bool AirspyHFInput::start()
|
||||
m_airspyHFWorkerThread->start();
|
||||
|
||||
qDebug("AirspyHFInput::startInput: started");
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return m_running;
|
||||
@ -248,12 +248,12 @@ bool AirspyHFInput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(m_settings, true);
|
||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(m_settings, true);
|
||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -294,12 +294,12 @@ void AirspyHFInput::setCenterFrequency(qint64 centerFrequency)
|
||||
AirspyHFSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(settings, false);
|
||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(settings, false);
|
||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -311,10 +311,9 @@ bool AirspyHFInput::handleMessage(const Message& message)
|
||||
MsgConfigureAirspyHF& conf = (MsgConfigureAirspyHF&) message;
|
||||
qDebug() << "MsgConfigureAirspyHF::handleMessage: MsgConfigureAirspyHF";
|
||||
|
||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
||||
bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||
|
||||
if (!success)
|
||||
{
|
||||
if (!success) {
|
||||
qDebug("MsgConfigureAirspyHF::handleMessage: AirspyHF config error");
|
||||
}
|
||||
|
||||
@ -327,8 +326,7 @@ bool AirspyHFInput::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine()) {
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
@ -371,27 +369,11 @@ void AirspyHFInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFSett
|
||||
}
|
||||
}
|
||||
|
||||
bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "AirspyHFInput::applySettings: "
|
||||
<< " m_centerFrequency: " << settings.m_centerFrequency
|
||||
<< " m_devSampleRateIndex: " << settings.m_devSampleRateIndex
|
||||
<< " m_log2Decim: " << settings.m_log2Decim
|
||||
<< " m_LOppmTenths: " << settings.m_LOppmTenths
|
||||
<< " m_bandIndex: " << settings.m_bandIndex
|
||||
<< " m_transverterDeltaFrequency: " << settings.m_transverterDeltaFrequency
|
||||
<< " m_transverterMode: " << settings.m_transverterMode
|
||||
<< " m_useDSP: " << settings.m_useDSP
|
||||
<< " m_useAGC: " << settings.m_useAGC
|
||||
<< " m_agcHigh: " << settings.m_agcHigh
|
||||
<< " m_useLNA: " << settings.m_useLNA
|
||||
<< " m_attenuatorSteps: " << settings.m_attenuatorSteps
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
||||
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
|
||||
<< " m_dcBlock: " << settings.m_dcBlock
|
||||
<< " m_iqCorrection: " << settings.m_iqCorrection;
|
||||
<< " force: " << force
|
||||
<< settings.getDebugString(settingsKeys, force);
|
||||
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
@ -401,26 +383,14 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
|
||||
int sampleRateIndex = settings.m_devSampleRateIndex;
|
||||
|
||||
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_bandIndex != settings.m_bandIndex) || force) {
|
||||
reverseAPIKeys.append("bandIndex");
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
||||
if (settingsKeys.contains("devSampleRateIndex") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRateIndex");
|
||||
forwardChange = true;
|
||||
|
||||
if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
||||
@ -443,9 +413,8 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
if (settingsKeys.contains("log2Decim") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_airspyHFWorker)
|
||||
@ -455,47 +424,30 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
if (settingsKeys.contains("iqOrder") || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_airspyHFWorker) {
|
||||
m_airspyHFWorker->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
if (settingsKeys.contains("LOppmTenths") || force)
|
||||
{
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
rc = (airspyhf_error) airspyhf_set_calibration(m_dev, settings.m_LOppmTenths * 100);
|
||||
|
||||
if (rc != AIRSPYHF_SUCCESS)
|
||||
{
|
||||
if (rc != AIRSPYHF_SUCCESS) {
|
||||
qCritical("AirspyHFInput::applySettings: could not set LO ppm correction to %f", settings.m_LOppmTenths / 10.0f);
|
||||
}
|
||||
else if (m_airspyHFWorker)
|
||||
{
|
||||
} else if (m_airspyHFWorker) {
|
||||
qDebug("AirspyHFInput::applySettings: LO ppm correction set to %f", settings.m_LOppmTenths / 10.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
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_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
|
||||
if (force || settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency")
|
||||
|| settingsKeys.contains("transverterMode"))
|
||||
{
|
||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
@ -517,10 +469,8 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_useAGC != settings.m_useAGC) || force)
|
||||
if (settingsKeys.contains("useAGC") || force)
|
||||
{
|
||||
reverseAPIKeys.append("useAGC");
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
rc = (airspyhf_error) airspyhf_set_hf_agc(m_dev, settings.m_useAGC ? 1 : 0);
|
||||
@ -533,10 +483,8 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_agcHigh != settings.m_agcHigh) || force)
|
||||
if (settingsKeys.contains("agcHigh") || force)
|
||||
{
|
||||
reverseAPIKeys.append("agcHigh");
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
rc = (airspyhf_error) airspyhf_set_hf_agc_threshold(m_dev, settings.m_agcHigh ? 1 : 0);
|
||||
@ -549,10 +497,8 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_useDSP != settings.m_useDSP) || force)
|
||||
if (settingsKeys.contains("useDSP") || force)
|
||||
{
|
||||
reverseAPIKeys.append("useDSP");
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
rc = (airspyhf_error) airspyhf_set_lib_dsp(m_dev, settings.m_useDSP ? 1 : 0);
|
||||
@ -565,7 +511,7 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_useLNA != settings.m_useLNA) || force)
|
||||
if (settingsKeys.contains("useLNA") || force)
|
||||
{
|
||||
reverseAPIKeys.append("useLNA");
|
||||
|
||||
@ -581,10 +527,8 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_attenuatorSteps != settings.m_attenuatorSteps) || force)
|
||||
if (settingsKeys.contains("attenuatorSteps") || force)
|
||||
{
|
||||
reverseAPIKeys.append("attenuatorSteps");
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
rc = (airspyhf_error) airspyhf_set_hf_att(m_dev, settings.m_attenuatorSteps);
|
||||
@ -613,7 +557,12 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -663,12 +612,12 @@ int AirspyHFInput::webapiSettingsPutPatch(
|
||||
AirspyHFSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, force);
|
||||
MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, force);
|
||||
MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -820,7 +769,7 @@ int AirspyHFInput::webapiRun(
|
||||
return 200;
|
||||
}
|
||||
|
||||
void AirspyHFInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force)
|
||||
void AirspyHFInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(0); // single Rx
|
||||
|
@ -41,20 +41,23 @@ public:
|
||||
|
||||
public:
|
||||
const AirspyHFSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureAirspyHF* create(const AirspyHFSettings& settings, bool force)
|
||||
static MsgConfigureAirspyHF* create(const AirspyHFSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigureAirspyHF(settings, force);
|
||||
return new MsgConfigureAirspyHF(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
AirspyHFSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureAirspyHF(const AirspyHFSettings& settings, bool force) :
|
||||
MsgConfigureAirspyHF(const AirspyHFSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -151,11 +154,11 @@ private:
|
||||
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
bool applySettings(const AirspyHFSettings& settings, bool force);
|
||||
bool applySettings(const AirspyHFSettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
||||
void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const AirspyHFSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -126,3 +126,129 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AirspyHFSettings::applySettings(const QStringList& settingsKeys, const AirspyHFSettings& 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("bandIndex")) {
|
||||
m_bandIndex = settings.m_bandIndex;
|
||||
}
|
||||
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("useDSP")) {
|
||||
m_useDSP = settings.m_useDSP;
|
||||
}
|
||||
if (settingsKeys.contains("useAGC")) {
|
||||
m_useAGC = settings.m_useAGC;
|
||||
}
|
||||
if (settingsKeys.contains("agcHigh")) {
|
||||
m_agcHigh = settings.m_agcHigh;
|
||||
}
|
||||
if (settingsKeys.contains("useLNA")) {
|
||||
m_useLNA = settings.m_useLNA;
|
||||
}
|
||||
if (settingsKeys.contains("attenuatorSteps")) {
|
||||
m_attenuatorSteps = settings.m_attenuatorSteps;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection")) {
|
||||
m_iqCorrection = settings.m_iqCorrection;
|
||||
}
|
||||
}
|
||||
|
||||
QString AirspyHFSettings::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("bandIndex") || force) {
|
||||
ostr << " m_bandIndex: " << m_bandIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useDSP") || force) {
|
||||
ostr << " m_useDSP: " << m_useDSP;
|
||||
}
|
||||
if (settingsKeys.contains("useAGC") || force) {
|
||||
ostr << " m_useAGC: " << m_useAGC;
|
||||
}
|
||||
if (settingsKeys.contains("agcHigh") || force) {
|
||||
ostr << " m_agcHigh: " << m_agcHigh;
|
||||
}
|
||||
if (settingsKeys.contains("useLNA") || force) {
|
||||
ostr << " m_useLNA: " << m_useLNA;
|
||||
}
|
||||
if (settingsKeys.contains("attenuatorSteps") || force) {
|
||||
ostr << " m_attenuatorSteps: " << m_attenuatorSteps;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection") || force) {
|
||||
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ struct AirspyHFSettings
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const AirspyHFSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* _AIRSPYHFF_AIRSPYHFSETTINGS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user