mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
USRP output: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
1060c4839e
commit
17e9a25c9e
@ -322,7 +322,7 @@ bool USRPOutput::acquireChannel()
|
||||
|
||||
// Apply settings before creating stream
|
||||
// However, don't set LPF to <10MHz at this stage, otherwise there is massive TX LO leakage
|
||||
applySettings(m_settings, true, true);
|
||||
applySettings(m_settings, QList<QString>(), true, true);
|
||||
usrp->set_tx_bandwidth(56000000, m_deviceShared.m_channel);
|
||||
|
||||
// set up the stream
|
||||
@ -375,7 +375,7 @@ void USRPOutput::releaseChannel()
|
||||
|
||||
void USRPOutput::init()
|
||||
{
|
||||
applySettings(m_settings, false, true);
|
||||
applySettings(m_settings, QList<QString>(), false, true);
|
||||
}
|
||||
|
||||
bool USRPOutput::start()
|
||||
@ -386,8 +386,7 @@ bool USRPOutput::start()
|
||||
|
||||
if (m_running) { stop(); }
|
||||
|
||||
if (!acquireChannel())
|
||||
{
|
||||
if (!acquireChannel()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -435,12 +434,12 @@ bool USRPOutput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureUSRP* message = MsgConfigureUSRP::create(m_settings, true);
|
||||
MsgConfigureUSRP* message = MsgConfigureUSRP::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureUSRP* messageToGUI = MsgConfigureUSRP::create(m_settings, true);
|
||||
MsgConfigureUSRP* messageToGUI = MsgConfigureUSRP::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -468,12 +467,12 @@ void USRPOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
USRPOutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureUSRP* message = MsgConfigureUSRP::create(settings, false);
|
||||
MsgConfigureUSRP* message = MsgConfigureUSRP::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureUSRP* messageToGUI = MsgConfigureUSRP::create(settings, false);
|
||||
MsgConfigureUSRP* messageToGUI = MsgConfigureUSRP::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -560,8 +559,7 @@ bool USRPOutput::handleMessage(const Message& message)
|
||||
MsgConfigureUSRP& conf = (MsgConfigureUSRP&) message;
|
||||
qDebug() << "USRPOutput::handleMessage: MsgConfigureUSRP";
|
||||
|
||||
if (!applySettings(conf.getSettings(), false, conf.getForce()))
|
||||
{
|
||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), false, conf.getForce())) {
|
||||
qDebug("USRPOutput::handleMessage config error");
|
||||
}
|
||||
|
||||
@ -574,8 +572,7 @@ bool USRPOutput::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine()) {
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
@ -671,28 +668,25 @@ bool USRPOutput::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetStream, bool force)
|
||||
bool USRPOutput::applySettings(const USRPOutputSettings& settings, const QList<QString>& settingsKeys, bool preGetStream, bool force)
|
||||
{
|
||||
qDebug() << "USRPOutput::applySettings: preGetStream:" << preGetStream << " force:" << force << settings.getDebugString(settingsKeys, force);
|
||||
bool forwardChangeOwnDSP = false;
|
||||
bool forwardChangeTxDSP = false;
|
||||
bool forwardChangeAllDSP = false;
|
||||
bool forwardClockSource = false;
|
||||
bool checkRates = false;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
|
||||
// apply settings
|
||||
|
||||
if ((m_settings.m_clockSource != settings.m_clockSource) || force)
|
||||
if (settingsKeys.contains("clockSource") || force)
|
||||
{
|
||||
reverseAPIKeys.append("clockSource");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && (m_channelAcquired || preGetStream))
|
||||
{
|
||||
try
|
||||
@ -718,9 +712,8 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)
|
||||
if (settingsKeys.contains("devSampleRate") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
forwardChangeAllDSP = true;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && (m_channelAcquired || preGetStream))
|
||||
@ -731,15 +724,12 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_loOffset != settings.m_loOffset)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
if (settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("loOffset")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency")
|
||||
|| force)
|
||||
{
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
forwardChangeTxDSP = true;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && (m_channelAcquired || preGetStream))
|
||||
@ -759,12 +749,9 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate)
|
||||
|| (m_settings.m_log2SoftInterp != settings.m_log2SoftInterp) || force)
|
||||
if (settingsKeys.contains("devSampleRate")
|
||||
|| settingsKeys.contains("log2SoftInterp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
reverseAPIKeys.append("log2SoftInterp");
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
unsigned int fifoRate = (unsigned int) settings.m_devSampleRate / (1<<settings.m_log2SoftInterp);
|
||||
fifoRate = fifoRate < 48000U ? 48000U : fifoRate;
|
||||
@ -777,10 +764,8 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
qDebug("USRPOutput::applySettings: resize FIFO: rate %u", fifoRate);
|
||||
}
|
||||
|
||||
if ((m_settings.m_gain != settings.m_gain) || force)
|
||||
if (settingsKeys.contains("gain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("gain");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && (m_channelAcquired || preGetStream))
|
||||
{
|
||||
m_deviceShared.m_deviceParams->getDevice()->set_tx_gain(settings.m_gain, m_deviceShared.m_channel);
|
||||
@ -788,10 +773,8 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
|
||||
if (settingsKeys.contains("lpfBW") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lpfBW");
|
||||
|
||||
// Don't set bandwidth before get_tx_stream (See above)
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
@ -800,9 +783,8 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2SoftInterp != settings.m_log2SoftInterp) || force)
|
||||
if (settingsKeys.contains("log2SoftInterp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2SoftInterp");
|
||||
forwardChangeOwnDSP = true;
|
||||
m_deviceShared.m_log2Soft = settings.m_log2SoftInterp; // for buddies
|
||||
|
||||
@ -813,10 +795,8 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
if (settingsKeys.contains("antennaPath") || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && (m_channelAcquired || preGetStream))
|
||||
{
|
||||
m_deviceShared.m_deviceParams->getDevice()->set_tx_antenna(settings.m_antennaPath.toStdString(), m_deviceShared.m_channel);
|
||||
@ -824,16 +804,20 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
if (settingsKeys.contains("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;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
if (checkRates)
|
||||
{
|
||||
@ -965,21 +949,6 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, bool preGetSt
|
||||
}
|
||||
}
|
||||
|
||||
QLocale loc;
|
||||
|
||||
qDebug().noquote() << "USRPOutput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
|
||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||
<< " deviceCenterFrequency: " << deviceCenterFrequency
|
||||
<< " device stream sample rate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
|
||||
<< " sample rate with soft interpolation: " << loc.toString( m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp)) << "S/s"
|
||||
<< " m_log2SoftInterp: " << m_settings.m_log2SoftInterp
|
||||
<< " m_gain: " << m_settings.m_gain
|
||||
<< " m_lpfBW: " << loc.toString(static_cast<int>(m_settings.m_lpfBW))
|
||||
<< " m_antennaPath: " << m_settings.m_antennaPath
|
||||
<< " m_clockSource: " << m_settings.m_clockSource
|
||||
<< " force: " << force;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (std::exception &e)
|
||||
@ -1010,12 +979,12 @@ int USRPOutput::webapiSettingsPutPatch(
|
||||
USRPOutputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureUSRP *msg = MsgConfigureUSRP::create(settings, force);
|
||||
MsgConfigureUSRP *msg = MsgConfigureUSRP::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureUSRP *msgToGUI = MsgConfigureUSRP::create(settings, force);
|
||||
MsgConfigureUSRP *msgToGUI = MsgConfigureUSRP::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -1153,7 +1122,7 @@ void USRPOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response
|
||||
response.getUsrpOutputReport()->setDroppedPacketsCount(droppedPackets);
|
||||
}
|
||||
|
||||
void USRPOutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const USRPOutputSettings& settings, bool force)
|
||||
void USRPOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const USRPOutputSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(1); // single Tx
|
||||
|
@ -45,20 +45,22 @@ public:
|
||||
|
||||
public:
|
||||
const USRPOutputSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureUSRP* create(const USRPOutputSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureUSRP(settings, force);
|
||||
static MsgConfigureUSRP* create(const USRPOutputSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureUSRP(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
USRPOutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureUSRP(const USRPOutputSettings& settings, bool force) :
|
||||
MsgConfigureUSRP(const USRPOutputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -238,9 +240,9 @@ private:
|
||||
void resumeRxBuddies();
|
||||
void suspendTxBuddies();
|
||||
void resumeTxBuddies();
|
||||
bool applySettings(const USRPOutputSettings& settings, bool preGetStream, bool force = false);
|
||||
bool applySettings(const USRPOutputSettings& settings, const QList<QString>& settingsKeys, bool preGetStream, bool force = false);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const USRPOutputSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const USRPOutputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -116,6 +116,7 @@ void USRPOutputGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -128,6 +129,7 @@ void USRPOutputGUI::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
m_settings.m_centerFrequency = centerFrequency;
|
||||
displaySettings();
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -187,7 +189,13 @@ bool USRPOutputGUI::handleMessage(const Message& message)
|
||||
if (USRPOutput::MsgConfigureUSRP::match(message))
|
||||
{
|
||||
const USRPOutput::MsgConfigureUSRP& cfg = (USRPOutput::MsgConfigureUSRP&) 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);
|
||||
@ -273,14 +281,6 @@ void USRPOutputGUI::handleInputMessages()
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (USRPOutput::MsgConfigureUSRP::match(*message))
|
||||
{
|
||||
const USRPOutput::MsgConfigureUSRP& cfg = (USRPOutput::MsgConfigureUSRP&) *message;
|
||||
m_settings = cfg.getSettings();
|
||||
displaySettings();
|
||||
|
||||
delete message;
|
||||
}
|
||||
else if (USRPOutput::MsgStartStop::match(*message))
|
||||
{
|
||||
USRPOutput::MsgStartStop& notif = (USRPOutput::MsgStartStop&) *message;
|
||||
@ -402,8 +402,9 @@ void USRPOutputGUI::setCenterFrequencySetting(uint64_t kHzValue)
|
||||
|
||||
void USRPOutputGUI::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void USRPOutputGUI::updateHardware()
|
||||
@ -411,9 +412,10 @@ void USRPOutputGUI::updateHardware()
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "USRPOutputGUI::updateHardware";
|
||||
USRPOutput::MsgConfigureUSRP* message = USRPOutput::MsgConfigureUSRP::create(m_settings, m_forceSettings);
|
||||
USRPOutput::MsgConfigureUSRP* message = USRPOutput::MsgConfigureUSRP::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_usrpOutput->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -490,6 +492,7 @@ void USRPOutputGUI::on_startStop_toggled(bool checked)
|
||||
void USRPOutputGUI::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
setCenterFrequencySetting(value);
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -502,6 +505,7 @@ void USRPOutputGUI::on_sampleRate_changed(quint64 value)
|
||||
}
|
||||
|
||||
updateSampleRate();
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -520,18 +524,22 @@ void USRPOutputGUI::on_swInterp_currentIndexChanged(int index)
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftInterp);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("log2SoftInterp");
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void USRPOutputGUI::on_lpf_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfBW = value * 1000;
|
||||
m_settingsKeys.append("lpfBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void USRPOutputGUI::on_loOffset_changed(qint64 value)
|
||||
{
|
||||
m_settings.m_loOffset = value * 1000;
|
||||
m_settingsKeys.append("loOffset");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -539,6 +547,7 @@ void USRPOutputGUI::on_gain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_gain = value;
|
||||
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
|
||||
m_settingsKeys.append("gain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -546,6 +555,7 @@ void USRPOutputGUI::on_antenna_currentIndexChanged(int index)
|
||||
{
|
||||
(void) index;
|
||||
m_settings.m_antennaPath = ui->antenna->currentText();
|
||||
m_settingsKeys.append("antennaPath");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -553,6 +563,7 @@ void USRPOutputGUI::on_clockSource_currentIndexChanged(int index)
|
||||
{
|
||||
(void) index;
|
||||
m_settings.m_clockSource = ui->clockSource->currentText();
|
||||
m_settingsKeys.append("clockSource");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -563,6 +574,9 @@ void USRPOutputGUI::on_transverter_clicked()
|
||||
qDebug("USRPInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencySetting(ui->centerFrequency->getValueNew());
|
||||
m_settingsKeys.append("transverterMode");
|
||||
m_settingsKeys.append("transverterDeltaFrequency");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -589,6 +603,10 @@ void USRPOutputGUI::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();
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
|
||||
USRPOutput* m_usrpOutput; //!< Same object as above but gives easy access to USRPOutput methods and attributes that are used intensively
|
||||
USRPOutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>192</height>
|
||||
<height>220</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,13 +19,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>192</height>
|
||||
<height>220</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>192</height>
|
||||
<height>220</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
|
@ -111,4 +111,104 @@ bool USRPOutputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
}
|
||||
|
||||
void USRPOutputSettings::applySettings(const QStringList& settingsKeys, const USRPOutputSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("masterClockRate")) {
|
||||
m_masterClockRate = settings.m_masterClockRate;
|
||||
}
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("loOffset")) {
|
||||
m_loOffset = settings.m_loOffset;
|
||||
}
|
||||
if (settingsKeys.contains("log2SoftInterp")) {
|
||||
m_log2SoftInterp = settings.m_log2SoftInterp;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW")) {
|
||||
m_lpfBW = settings.m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("gain")) {
|
||||
m_gain = settings.m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath")) {
|
||||
m_antennaPath = settings.m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("clockSource")) {
|
||||
m_clockSource = settings.m_clockSource;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
QString USRPOutputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("masterClockRate") || force) {
|
||||
ostr << " m_masterClockRate: " << m_masterClockRate;
|
||||
}
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("loOffset") || force) {
|
||||
ostr << " m_loOffset: " << m_loOffset;
|
||||
}
|
||||
if (settingsKeys.contains("log2SoftInterp") || force) {
|
||||
ostr << " m_log2SoftInterp: " << m_log2SoftInterp;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW") || force) {
|
||||
ostr << " m_lpfBW: " << m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("gain") || force) {
|
||||
ostr << " m_gain: " << m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath") || force) {
|
||||
ostr << " m_antennaPath: " << m_antennaPath.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("clockSource") || force) {
|
||||
ostr << " m_clockSource: " << m_clockSource.toStdString();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ struct USRPOutputSettings
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const USRPOutputSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_USRPOUTPUT_USRPOUTPUTSETTINGS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user