1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

BladeRF1: Make settings assignments atomic. Part of #1329

This commit is contained in:
f4exb 2022-10-22 19:05:33 +02:00
parent a1161657ad
commit 58456273b7
6 changed files with 226 additions and 106 deletions

View File

@ -147,7 +147,7 @@ bool Bladerf1Input::openDevice()
void Bladerf1Input::init()
{
applySettings(m_settings, true);
applySettings(m_settings, QList<QString>(), true);
}
bool Bladerf1Input::start()
@ -170,7 +170,7 @@ bool Bladerf1Input::start()
m_bladerfThread->startWork();
// mutexLocker.unlock();
applySettings(m_settings, true);
applySettings(m_settings, QList<QString>(), true);
qDebug("BladerfInput::startInput: started");
m_running = true;
@ -234,12 +234,12 @@ bool Bladerf1Input::deserialize(const QByteArray& data)
success = false;
}
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(m_settings, true);
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(m_settings, QList<QString>(), true);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(m_settings, true);
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(m_settings, QList<QString>(), true);
m_guiMessageQueue->push(messageToGUI);
}
@ -267,12 +267,12 @@ void Bladerf1Input::setCenterFrequency(qint64 centerFrequency)
BladeRF1InputSettings settings = m_settings;
settings.m_centerFrequency = centerFrequency;
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(settings, false);
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(settings, QList<QString>{"centerFrequency"}, false);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(settings, false);
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(settings, QList<QString>{"centerFrequency"}, false);
m_guiMessageQueue->push(messageToGUI);
}
}
@ -284,8 +284,7 @@ bool Bladerf1Input::handleMessage(const Message& message)
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
qDebug() << "Bladerf1Input::handleMessage: MsgConfigureBladerf1";
if (!applySettings(conf.getSettings(), conf.getForce()))
{
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
qDebug("BladeRF config error");
}
@ -298,8 +297,7 @@ bool Bladerf1Input::handleMessage(const Message& message)
if (cmd.getStartStop())
{
if (m_deviceAPI->initDeviceEngine())
{
if (m_deviceAPI->initDeviceEngine()) {
m_deviceAPI->startDeviceEngine();
}
}
@ -320,31 +318,21 @@ bool Bladerf1Input::handleMessage(const Message& message)
}
}
bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool force)
bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force)
{
bool forwardChange = false;
QList<QString> reverseAPIKeys;
// QMutexLocker mutexLocker(&m_mutex);
qDebug() << "BladerfInput::applySettings: m_dev: " << m_dev;
qDebug() << "BladerfInput::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_lnaGain != settings.m_lnaGain) || force)
if (settingsKeys.contains("lnaGain") || force)
{
reverseAPIKeys.append("lnaGain");
if (m_dev != 0)
{
if(bladerf_set_lna_gain(m_dev, getLnaGain(settings.m_lnaGain)) != 0) {
@ -355,10 +343,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_vga1 != settings.m_vga1) || force)
if (settingsKeys.contains("vga1") || force)
{
reverseAPIKeys.append("vga1");
if (m_dev != 0)
{
if(bladerf_set_rxvga1(m_dev, settings.m_vga1) != 0) {
@ -369,10 +355,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_vga2 != settings.m_vga2) || force)
if (settingsKeys.contains("vga2") || force)
{
reverseAPIKeys.append("vga2");
if(m_dev != 0)
{
if(bladerf_set_rxvga2(m_dev, settings.m_vga2) != 0) {
@ -383,10 +367,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_xb200 != settings.m_xb200) || force)
if (settingsKeys.contains("xb200") || force)
{
reverseAPIKeys.append("xb200");
if (m_dev != 0)
{
bool changeSettings;
@ -430,10 +412,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_xb200Path != settings.m_xb200Path) || force)
if (settingsKeys.contains("xb200Path") || force)
{
reverseAPIKeys.append("xb200Path");
if (m_dev != 0)
{
if(bladerf_xb200_set_path(m_dev, BLADERF_MODULE_RX, settings.m_xb200Path) != 0) {
@ -444,10 +424,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_xb200Filter != settings.m_xb200Filter) || force)
if (settingsKeys.contains("xb200Filter") || force)
{
reverseAPIKeys.append("xb200Filter");
if (m_dev != 0)
{
if(bladerf_xb200_set_filterbank(m_dev, BLADERF_MODULE_RX, settings.m_xb200Filter) != 0) {
@ -458,9 +436,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
if (settingsKeys.contains("devSampleRate") || force)
{
reverseAPIKeys.append("devSampleRate");
forwardChange = true;
if (m_dev != 0)
@ -475,10 +452,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_bandwidth != settings.m_bandwidth) || force)
if (settingsKeys.contains("bandwidth") || force)
{
reverseAPIKeys.append("bandwidth");
if(m_dev != 0)
{
unsigned int actualBandwidth;
@ -491,10 +466,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
if (settingsKeys.contains("fcPos") || force)
{
reverseAPIKeys.append("fcPos");
if (m_bladerfThread)
{
m_bladerfThread->setFcPos((int) settings.m_fcPos);
@ -502,9 +475,8 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
if (settingsKeys.contains("log2Decim") || force)
{
reverseAPIKeys.append("log2Decim");
forwardChange = true;
if (m_bladerfThread)
@ -514,23 +486,17 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
}
}
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
if (settingsKeys.contains("iqOrder") || force)
{
reverseAPIKeys.append("iqOrder");
if (m_bladerfThread) {
m_bladerfThread->setIQOrder(settings.m_iqOrder);
}
}
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
reverseAPIKeys.append("centerFrequency");
}
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_devSampleRate != settings.m_devSampleRate)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
if (settingsKeys.contains("centerFrequency")
|| settingsKeys.contains("log2Decim")
|| settingsKeys.contains("fcPos")
|| settingsKeys.contains("devSampleRate") || force)
{
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
settings.m_centerFrequency,
@ -562,46 +528,29 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
if (settings.m_useReverseAPI)
{
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
(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);
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
settingsKeys.contains("reverseAPIAddress") ||
settingsKeys.contains("reverseAPIPort") ||
settingsKeys.contains("reverseAPIDeviceIndex");
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
}
m_settings = settings;
qDebug() << "BladerfInput::applySettings: "
<< " m_centerFrequency: " << m_settings.m_centerFrequency << " Hz"
<< " m_bandwidth: " << m_settings.m_bandwidth
<< " m_lnaGain: " << m_settings.m_lnaGain
<< " m_vga1: " << m_settings.m_vga1
<< " m_vga2: " << m_settings.m_vga2
<< " m_log2Decim: " << m_settings.m_log2Decim
<< " m_iqOrder: " << m_settings.m_iqOrder
<< " m_fcPos: " << m_settings.m_fcPos
<< " m_devSampleRate: " << m_settings.m_devSampleRate
<< " m_dcBlock: " << m_settings.m_dcBlock
<< " m_iqCorrection: " << m_settings.m_iqCorrection
<< " m_xb200Filter: " << m_settings.m_xb200Filter
<< " m_xb200Path: " << m_settings.m_xb200Path
<< " m_xb200: " << m_settings.m_xb200;
if (force) {
m_settings = settings;
} else {
m_settings.applySettings(settingsKeys, settings);
}
return true;
}
bladerf_lna_gain Bladerf1Input::getLnaGain(int lnaGain)
{
if (lnaGain == 2)
{
if (lnaGain == 2) {
return BLADERF_LNA_GAIN_MAX;
}
else if (lnaGain == 1)
{
} else if (lnaGain == 1) {
return BLADERF_LNA_GAIN_MID;
}
else
{
} else {
return BLADERF_LNA_GAIN_BYPASS;
}
}
@ -656,12 +605,12 @@ int Bladerf1Input::webapiSettingsPutPatch(
BladeRF1InputSettings settings = m_settings;
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, force);
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, deviceSettingsKeys, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, force);
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, deviceSettingsKeys, force);
m_guiMessageQueue->push(msgToGUI);
}
@ -758,7 +707,7 @@ int Bladerf1Input::webapiRun(
return 200;
}
void Bladerf1Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
void Bladerf1Input::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setDirection(0); // single Rx

View File

@ -42,20 +42,23 @@ public:
public:
const BladeRF1InputSettings& getSettings() const { return m_settings; }
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
bool getForce() const { return m_force; }
static MsgConfigureBladerf1* create(const BladeRF1InputSettings& settings, bool force)
static MsgConfigureBladerf1* create(const BladeRF1InputSettings& settings, QList<QString> settingsKeys, bool force)
{
return new MsgConfigureBladerf1(settings, force);
return new MsgConfigureBladerf1(settings, settingsKeys, force);
}
private:
BladeRF1InputSettings m_settings;
QList<QString> m_settingsKeys;
bool m_force;
MsgConfigureBladerf1(const BladeRF1InputSettings& settings, bool force) :
MsgConfigureBladerf1(const BladeRF1InputSettings& settings, QList<QString> settingsKeys, bool force) :
Message(),
m_settings(settings),
m_settingsKeys(settingsKeys),
m_force(force)
{ }
};
@ -141,9 +144,9 @@ private:
bool openDevice();
void closeDevice();
bool applySettings(const BladeRF1InputSettings& settings, bool force);
bool applySettings(const BladeRF1InputSettings& settings, const QList<QString>& settingsKeys, bool force);
bladerf_lna_gain getLnaGain(int lnaGain);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force);
void webapiReverseSendStartStop(bool start);
private slots:

View File

@ -96,6 +96,7 @@ void Bladerf1InputGui::resetToDefaults()
{
m_settings.resetToDefaults();
displaySettings();
m_forceSettings = true;
sendSettings();
}
@ -128,7 +129,13 @@ bool Bladerf1InputGui::handleMessage(const Message& message)
if (Bladerf1Input::MsgConfigureBladerf1::match(message))
{
const Bladerf1Input::MsgConfigureBladerf1& cfg = (Bladerf1Input::MsgConfigureBladerf1&) 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);
@ -266,6 +273,7 @@ void Bladerf1InputGui::sendSettings()
void Bladerf1InputGui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
m_settingsKeys.append("centerFrequency");
sendSettings();
}
@ -278,18 +286,21 @@ void Bladerf1InputGui::on_sampleRate_changed(quint64 value)
}
displayFcTooltip();
m_settingsKeys.append("devSampleRate");
sendSettings();
}
void Bladerf1InputGui::on_dcOffset_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
m_settingsKeys.append("dcBlock");
sendSettings();
}
void Bladerf1InputGui::on_iqImbalance_toggled(bool checked)
{
m_settings.m_iqCorrection = checked;
m_settingsKeys.append("iqCorrection");
sendSettings();
}
@ -297,6 +308,7 @@ void Bladerf1InputGui::on_bandwidth_currentIndexChanged(int index)
{
int newbw = BladerfBandwidths::getBandwidth(index);
m_settings.m_bandwidth = newbw * 1000;
m_settingsKeys.append("bandwidth");
sendSettings();
}
@ -315,6 +327,8 @@ void Bladerf1InputGui::on_decim_currentIndexChanged(int index)
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
}
m_settingsKeys.append("log2Decim");
m_settingsKeys.append("devSampleRate");
sendSettings();
}
@ -322,6 +336,7 @@ void Bladerf1InputGui::on_fcPos_currentIndexChanged(int index)
{
m_settings.m_fcPos = (BladeRF1InputSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index);
displayFcTooltip();
m_settingsKeys.append("fcPos");
sendSettings();
}
@ -333,6 +348,7 @@ void Bladerf1InputGui::on_lna_currentIndexChanged(int index)
return;
m_settings.m_lnaGain = index;
m_settingsKeys.append("lnaGain");
sendSettings();
}
@ -343,6 +359,7 @@ void Bladerf1InputGui::on_vga1_valueChanged(int value)
ui->vga1Text->setText(tr("%1dB").arg(value));
m_settings.m_vga1 = value;
m_settingsKeys.append("vga1");
sendSettings();
}
@ -353,6 +370,7 @@ void Bladerf1InputGui::on_vga2_valueChanged(int value)
ui->vga2Text->setText(tr("%1dB").arg(value));
m_settings.m_vga2 = value;
m_settingsKeys.append("vga2");
sendSettings();
}
@ -362,54 +380,72 @@ void Bladerf1InputGui::on_xb200_currentIndexChanged(int index)
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_BYPASS;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
}
else if (index == 2) // Auto 1dB
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_AUTO_1DB;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else if (index == 3) // Auto 3dB
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_AUTO_3DB;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else if (index == 4) // Custom
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_CUSTOM;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else if (index == 5) // 50 MHz
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_50M;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else if (index == 6) // 144 MHz
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_144M;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else if (index == 7) // 222 MHz
{
m_settings.m_xb200 = true;
m_settings.m_xb200Path = BLADERF_XB200_MIX;
m_settings.m_xb200Filter = BLADERF_XB200_222M;
m_settingsKeys.append("xb200");
m_settingsKeys.append("xb200Path");
m_settingsKeys.append("xb200Filter");
}
else // no xb200
{
m_settings.m_xb200 = false;
m_settingsKeys.append("xb200");
}
if (m_settings.m_xb200)
{
if (m_settings.m_xb200) {
ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);
}
else
{
} else {
ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN/1000, BLADERF_FREQUENCY_MAX/1000);
}
@ -436,8 +472,9 @@ void Bladerf1InputGui::updateHardware()
if (m_doApplySettings)
{
qDebug() << "BladerfGui::updateHardware";
Bladerf1Input::MsgConfigureBladerf1* message = Bladerf1Input::MsgConfigureBladerf1::create(m_settings, m_forceSettings);
Bladerf1Input::MsgConfigureBladerf1* message = Bladerf1Input::MsgConfigureBladerf1::create(m_settings, m_settingsKeys, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_settingsKeys.clear();
m_forceSettings = false;
m_updateTimer.stop();
}
@ -536,6 +573,10 @@ void Bladerf1InputGui::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("transverterMode");
m_settingsKeys.append("m_transverterDeltaFrequency");
m_settingsKeys.append("m_iqOrder");
m_settingsKeys.append("centerFrequency");
sendSettings();
}

View File

@ -51,6 +51,7 @@ private:
bool m_forceSettings;
bool m_doApplySettings;
BladeRF1InputSettings m_settings;
QList<QString> m_settingsKeys;
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
QTimer m_updateTimer;
QTimer m_statusTimer;

View File

@ -126,3 +126,127 @@ bool BladeRF1InputSettings::deserialize(const QByteArray& data)
return false;
}
}
void BladeRF1InputSettings::applySettings(const QStringList& settingsKeys, const BladeRF1InputSettings& settings)
{
if (settingsKeys.contains("centerFrequency")) {
m_centerFrequency = settings.m_centerFrequency;
}
if (settingsKeys.contains("devSampleRate")) {
m_devSampleRate = settings.m_devSampleRate;
}
if (settingsKeys.contains("lnaGain")) {
m_lnaGain = settings.m_lnaGain;
}
if (settingsKeys.contains("vga1")) {
m_vga1 = settings.m_vga1;
}
if (settingsKeys.contains("vga2")) {
m_vga2 = settings.m_vga2;
}
if (settingsKeys.contains("bandwidth")) {
m_bandwidth = settings.m_bandwidth;
}
if (settingsKeys.contains("fcPos")) {
m_fcPos = settings.m_fcPos;
}
if (settingsKeys.contains("xb200")) {
m_xb200 = settings.m_xb200;
}
if (settingsKeys.contains("xb200Path")) {
m_xb200Path = settings.m_xb200Path;
}
if (settingsKeys.contains("xb200Filter")) {
m_xb200Filter = settings.m_xb200Filter;
}
if (settingsKeys.contains("dcBlock")) {
m_dcBlock = settings.m_dcBlock;
}
if (settingsKeys.contains("iqCorrection")) {
m_iqCorrection = settings.m_iqCorrection;
}
if (settingsKeys.contains("iqOrder")) {
m_iqOrder = settings.m_iqOrder;
}
if (settingsKeys.contains("fileRecordName")) {
m_fileRecordName = settings.m_fileRecordName;
}
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 BladeRF1InputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
{
std::ostringstream ostr;
if (settingsKeys.contains("centerFrequency") || force) {
ostr << " m_centerFrequency: " << m_centerFrequency;
}
if (settingsKeys.contains("devSampleRate") || force) {
ostr << " m_devSampleRate: " << m_devSampleRate;
}
if (settingsKeys.contains("lnaGain") || force) {
ostr << " m_lnaGain: " << m_lnaGain;
}
if (settingsKeys.contains("vga1") || force) {
ostr << " m_vga1: " << m_vga1;
}
if (settingsKeys.contains("vga2") || force) {
ostr << " m_vga2: " << m_vga2;
}
if (settingsKeys.contains("bandwidth") || force) {
ostr << " m_bandwidth: " << m_bandwidth;
}
if (settingsKeys.contains("log2Decim") || force) {
ostr << " m_log2Decim: " << m_log2Decim;
}
if (settingsKeys.contains("fcPos") || force) {
ostr << " m_fcPos: " << m_fcPos;
}
if (settingsKeys.contains("xb200") || force) {
ostr << " m_xb200: " << m_xb200;
}
if (settingsKeys.contains("xb200Path") || force) {
ostr << " m_xb200Path: " << m_xb200Path;
}
if (settingsKeys.contains("xb200Filter") || force) {
ostr << " m_xb200Filter: " << m_xb200Filter;
}
if (settingsKeys.contains("dcBlock") || force) {
ostr << " m_dcBlock: " << m_dcBlock;
}
if (settingsKeys.contains("iqCorrection") || force) {
ostr << " m_iqCorrection: " << m_iqCorrection;
}
if (settingsKeys.contains("iqOrder") || force) {
ostr << " m_iqOrder: " << m_iqOrder;
}
if (settingsKeys.contains("fileRecordName") || force) {
ostr << " m_fileRecordName: " << m_fileRecordName.toStdString();
}
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());
}

View File

@ -53,6 +53,8 @@ struct BladeRF1InputSettings {
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void applySettings(const QStringList& settingsKeys, const BladeRF1InputSettings& settings);
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
};
#endif /* _BLADERF_BLADERFINPUTSETTINGS_H_ */