kopia lustrzana https://github.com/f4exb/sdrangel
XTRX output: Make settings assignments atomic. Part of #1329
rodzic
17e9a25c9e
commit
795753738c
|
@ -188,7 +188,7 @@ void XTRXOutput::closeDevice()
|
|||
|
||||
void XTRXOutput::init()
|
||||
{
|
||||
applySettings(m_settings, true, false);
|
||||
applySettings(m_settings, QList<QString>(), true, false);
|
||||
}
|
||||
|
||||
XTRXOutputThread *XTRXOutput::findThread()
|
||||
|
@ -342,7 +342,7 @@ bool XTRXOutput::start()
|
|||
xtrxOutputThread->setFifo(requestedChannel, &m_sampleSourceFifo);
|
||||
xtrxOutputThread->setLog2Interpolation(requestedChannel, m_settings.m_log2SoftInterp);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
|
||||
if (needsStart)
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ void XTRXOutput::stop()
|
|||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_sink->setThread(nullptr);
|
||||
}
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
xtrxOutputThread->startWork();
|
||||
}
|
||||
|
||||
|
@ -479,12 +479,12 @@ bool XTRXOutput::deserialize(const QByteArray& data)
|
|||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureXTRX* message = MsgConfigureXTRX::create(m_settings, true);
|
||||
MsgConfigureXTRX* message = MsgConfigureXTRX::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureXTRX* messageToGUI = MsgConfigureXTRX::create(m_settings, true);
|
||||
MsgConfigureXTRX* messageToGUI = MsgConfigureXTRX::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
|
@ -544,12 +544,12 @@ void XTRXOutput::setCenterFrequency(qint64 centerFrequency)
|
|||
XTRXOutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency - (m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0);
|
||||
|
||||
MsgConfigureXTRX* message = MsgConfigureXTRX::create(settings, false);
|
||||
MsgConfigureXTRX* message = MsgConfigureXTRX::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureXTRX* messageToGUI = MsgConfigureXTRX::create(settings, false);
|
||||
MsgConfigureXTRX* messageToGUI = MsgConfigureXTRX::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
@ -593,8 +593,7 @@ bool XTRXOutput::handleMessage(const Message& message)
|
|||
MsgConfigureXTRX& conf = (MsgConfigureXTRX&) message;
|
||||
qDebug() << "XTRXOutput::handleMessage: MsgConfigureXTRX";
|
||||
|
||||
if (!applySettings(conf.getSettings(), conf.getForce()))
|
||||
{
|
||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
||||
qDebug("XTRXOutput::handleMessage config error");
|
||||
}
|
||||
|
||||
|
@ -623,7 +622,7 @@ bool XTRXOutput::handleMessage(const Message& message)
|
|||
|
||||
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change
|
||||
{
|
||||
applySettings(m_settings, false, true);
|
||||
applySettings(m_settings, QList<QString>{"ncoEnable"}, false, true);
|
||||
}
|
||||
|
||||
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
|
||||
|
@ -756,11 +755,11 @@ bool XTRXOutput::handleMessage(const Message& message)
|
|||
}
|
||||
}
|
||||
|
||||
bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, bool forceNCOFrequency)
|
||||
bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, const QList<QString>& settingsKeys, bool force, bool forceNCOFrequency)
|
||||
{
|
||||
qDebug() << "XTRXOutput::applySettings: force:" << force << " forceNCOFrequency:" << forceNCOFrequency << settings.getDebugString(settingsKeys, force);
|
||||
int requestedChannel = m_deviceAPI->getDeviceItemIndex();
|
||||
XTRXOutputThread *outputThread = findThread();
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
bool forwardChangeOwnDSP = false;
|
||||
bool forwardChangeTxDSP = false;
|
||||
|
@ -772,23 +771,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
|
||||
// apply settings
|
||||
|
||||
qDebug() << "XTRXOutput::applySettings: m_centerFrequency: " << settings.m_centerFrequency
|
||||
<< " m_devSampleRate: " << settings.m_devSampleRate
|
||||
<< " m_log2SoftInterp: " << settings.m_log2SoftInterp
|
||||
<< " m_gain: " << settings.m_gain
|
||||
<< " m_lpfBW: " << settings.m_lpfBW
|
||||
<< " m_pwrmode: " << settings.m_pwrmode
|
||||
<< " m_ncoEnable: " << settings.m_ncoEnable
|
||||
<< " m_ncoFrequency: " << settings.m_ncoFrequency
|
||||
<< " m_antennaPath: " << settings.m_antennaPath
|
||||
<< " m_extClock: " << settings.m_extClock
|
||||
<< " m_extClockFreq: " << settings.m_extClockFreq
|
||||
<< " force: " << force;
|
||||
|
||||
if ((m_settings.m_pwrmode != settings.m_pwrmode))
|
||||
if (settingsKeys.contains("pwrmode") || force)
|
||||
{
|
||||
reverseAPIKeys.append("pwrmode");
|
||||
|
||||
if (m_deviceShared.m_dev->getDevice())
|
||||
{
|
||||
if (xtrx_val_set(m_deviceShared.m_dev->getDevice(),
|
||||
|
@ -801,15 +785,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_extClock != settings.m_extClock) || force) {
|
||||
reverseAPIKeys.append("extClock");
|
||||
}
|
||||
if ((m_settings.m_extClockFreq != settings.m_extClockFreq) || force) {
|
||||
reverseAPIKeys.append("extClockFreq");
|
||||
}
|
||||
|
||||
if ((m_settings.m_extClock != settings.m_extClock)
|
||||
|| (settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force)
|
||||
if (settingsKeys.contains("extClock")
|
||||
|| (settings.m_extClock && settingsKeys.contains("extClockFreq")) || force)
|
||||
{
|
||||
if (m_deviceShared.m_dev->getDevice())
|
||||
{
|
||||
|
@ -827,15 +804,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) {
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
}
|
||||
if ((m_settings.m_log2HardInterp != settings.m_log2HardInterp) || force) {
|
||||
reverseAPIKeys.append("log2HardInterp");
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate)
|
||||
|| (m_settings.m_log2HardInterp != settings.m_log2HardInterp) || force)
|
||||
if (settingsKeys.contains("devSampleRate")
|
||||
|| settingsKeys.contains("log2HardInterp") || force)
|
||||
{
|
||||
forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate;
|
||||
|
||||
|
@ -844,10 +814,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gain != settings.m_gain) || force)
|
||||
if (settingsKeys.contains("gain") || force)
|
||||
{
|
||||
reverseAPIKeys.append("gain");
|
||||
|
||||
if (m_deviceShared.m_dev->getDevice())
|
||||
{
|
||||
if (xtrx_set_gain(m_deviceShared.m_dev->getDevice(),
|
||||
|
@ -862,10 +830,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
|
||||
if (settingsKeys.contains("lpfBW") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lpfBW");
|
||||
|
||||
if (m_deviceShared.m_dev->getDevice()) {
|
||||
doLPCalibration = true;
|
||||
}
|
||||
|
@ -898,9 +864,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
#endif
|
||||
|
||||
if ((m_settings.m_log2SoftInterp != settings.m_log2SoftInterp) || force)
|
||||
if (settingsKeys.contains("log2SoftInterp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2SoftInterp");
|
||||
forwardChangeOwnDSP = true;
|
||||
|
||||
if (outputThread)
|
||||
|
@ -910,8 +875,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate)
|
||||
|| (m_settings.m_log2SoftInterp != settings.m_log2SoftInterp) || force)
|
||||
if (settingsKeys.contains("devSampleRate")
|
||||
|| settingsKeys.contains("log2SoftInterp") || force)
|
||||
{
|
||||
unsigned int fifoRate = std::max(
|
||||
(unsigned int) settings.m_devSampleRate / (1<<settings.m_log2SoftInterp),
|
||||
|
@ -919,10 +884,8 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(fifoRate));
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
if (settingsKeys.contains("antennaPath") || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
|
||||
if (m_deviceShared.m_dev->getDevice())
|
||||
{
|
||||
if (xtrx_set_antenna(m_deviceShared.m_dev->getDevice(), settings.m_antennaPath) < 0) {
|
||||
|
@ -933,35 +896,30 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
|
||||
{
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
doChangeFreq = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_ncoFrequency != settings.m_ncoFrequency) || force) {
|
||||
reverseAPIKeys.append("ncoFrequency");
|
||||
}
|
||||
if ((m_settings.m_ncoEnable != settings.m_ncoEnable) || force) {
|
||||
reverseAPIKeys.append("ncoEnable");
|
||||
}
|
||||
|
||||
if ((m_settings.m_ncoFrequency != settings.m_ncoFrequency)
|
||||
|| (m_settings.m_ncoEnable != settings.m_ncoEnable) || force)
|
||||
if (settingsKeys.contains("ncoFrequency")
|
||||
|| settingsKeys.contains("ncoEnable") || force)
|
||||
{
|
||||
forceNCOFrequency = true;
|
||||
}
|
||||
|
||||
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 (doChangeSampleRate && (settings.m_devSampleRate != 0))
|
||||
{
|
||||
|
@ -1163,14 +1121,6 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||
}
|
||||
}
|
||||
|
||||
qDebug() << "XTRXOutput::applySettings:"
|
||||
<< " device stream sample rate: " << getDevSampleRate() << "S/s"
|
||||
<< " sample rate with soft interpolation: " << getSampleRate() << "S/s"
|
||||
<< " forceNCOFrequency: " << forceNCOFrequency
|
||||
<< " doLPCalibration: " << doLPCalibration
|
||||
<< " doChangeFreq: " << doChangeFreq
|
||||
<< " doChangeSampleRate: " << doChangeSampleRate;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1195,12 +1145,12 @@ int XTRXOutput::webapiSettingsPutPatch(
|
|||
XTRXOutputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureXTRX *msg = MsgConfigureXTRX::create(settings, force);
|
||||
MsgConfigureXTRX *msg = MsgConfigureXTRX::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureXTRX *msgToGUI = MsgConfigureXTRX::create(settings, force);
|
||||
MsgConfigureXTRX *msgToGUI = MsgConfigureXTRX::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
|
@ -1353,7 +1303,7 @@ void XTRXOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response
|
|||
response.getXtrxOutputReport()->setGpsLock(gpsStatus ? 1 : 0);
|
||||
}
|
||||
|
||||
void XTRXOutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force)
|
||||
void XTRXOutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(1); // Single Tx
|
||||
|
|
|
@ -40,22 +40,24 @@ public:
|
|||
class MsgConfigureXTRX : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const XTRXOutputSettings& getSettings() const { return m_settings; }
|
||||
public:
|
||||
const XTRXOutputSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureXTRX* create(const XTRXOutputSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureXTRX(settings, force);
|
||||
static MsgConfigureXTRX* create(const XTRXOutputSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureXTRX(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
XTRXOutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureXTRX(const XTRXOutputSettings& settings, bool force) :
|
||||
MsgConfigureXTRX(const XTRXOutputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
|
@ -249,9 +251,9 @@ private:
|
|||
|
||||
void suspendRxThread();
|
||||
void resumeRxThread();
|
||||
bool applySettings(const XTRXOutputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
||||
bool applySettings(const XTRXOutputSettings& settings, const QList<QString>& settingsKeys, bool force = false, bool forceNCOFrequency = false);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const XTRXOutputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -98,6 +98,7 @@ void XTRXOutputGUI::resetToDefaults()
|
|||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -239,7 +240,13 @@ void XTRXOutputGUI::handleInputMessages()
|
|||
{
|
||||
qDebug("XTRXOutputGUI::handleInputMessages: MsgConfigureXTRX");
|
||||
const XTRXOutput::MsgConfigureXTRX& cfg = (XTRXOutput::MsgConfigureXTRX&) *message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
displaySettings();
|
||||
|
||||
delete message;
|
||||
|
@ -372,8 +379,9 @@ void XTRXOutputGUI::setCenterFrequencySetting(uint64_t kHzValue)
|
|||
|
||||
void XTRXOutputGUI::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::updateHardware()
|
||||
|
@ -381,9 +389,10 @@ void XTRXOutputGUI::updateHardware()
|
|||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "XTRXOutputGUI::updateHardware";
|
||||
XTRXOutput::MsgConfigureXTRX* message = XTRXOutput::MsgConfigureXTRX::create(m_settings, m_forceSettings);
|
||||
XTRXOutput::MsgConfigureXTRX* message = XTRXOutput::MsgConfigureXTRX::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_XTRXOutput->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +401,7 @@ void XTRXOutputGUI::updateStatus()
|
|||
{
|
||||
int state = m_deviceUISet->m_deviceAPI->state();
|
||||
|
||||
if(m_lastEngineState != state)
|
||||
if (m_lastEngineState != state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
|
@ -460,6 +469,7 @@ void XTRXOutputGUI::on_startStop_toggled(bool checked)
|
|||
void XTRXOutputGUI::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
setCenterFrequencySetting(value);
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -467,6 +477,7 @@ void XTRXOutputGUI::on_ncoFrequency_changed(qint64 value)
|
|||
{
|
||||
m_settings.m_ncoFrequency = value;
|
||||
setCenterFrequencyDisplay();
|
||||
m_settingsKeys.append("ncoFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -474,6 +485,7 @@ void XTRXOutputGUI::on_ncoEnable_toggled(bool checked)
|
|||
{
|
||||
m_settings.m_ncoEnable = checked;
|
||||
setCenterFrequencyDisplay();
|
||||
m_settingsKeys.append("ncoEnable");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -487,7 +499,9 @@ void XTRXOutputGUI::on_sampleRate_changed(quint64 value)
|
|||
|
||||
updateDACRate();
|
||||
setNCODisplay();
|
||||
sendSettings();}
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
|
||||
{
|
||||
|
@ -496,6 +510,7 @@ void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
|
|||
}
|
||||
|
||||
m_settings.m_log2HardInterp = index;
|
||||
m_settingsKeys.append("log2HardInterp");
|
||||
|
||||
updateDACRate();
|
||||
setNCODisplay();
|
||||
|
@ -517,12 +532,15 @@ void XTRXOutputGUI::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 XTRXOutputGUI::on_lpf_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfBW = value * 1000;
|
||||
m_settingsKeys.append("lpfBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -530,12 +548,14 @@ void XTRXOutputGUI::on_gain_valueChanged(int value)
|
|||
{
|
||||
m_settings.m_gain = value;
|
||||
ui->gainText->setText(tr("%1").arg(m_settings.m_gain));
|
||||
m_settingsKeys.append("gain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::on_antenna_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_antennaPath = (xtrx_antenna_t) (index + (int) XTRX_TX_H);
|
||||
m_settingsKeys.append("antennaPath");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -544,12 +564,15 @@ void XTRXOutputGUI::on_extClock_clicked()
|
|||
m_settings.m_extClock = ui->extClock->getExternalClockActive();
|
||||
m_settings.m_extClockFreq = ui->extClock->getExternalClockFrequency();
|
||||
qDebug("XTRXOutputGUI::on_extClock_clicked: %u Hz %s", m_settings.m_extClockFreq, m_settings.m_extClock ? "on" : "off");
|
||||
m_settingsKeys.append("extClock");
|
||||
m_settingsKeys.append("extClockFreq");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::on_pwrmode_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_pwrmode = index;
|
||||
m_settingsKeys.append("pwrmode");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -576,6 +599,10 @@ void XTRXOutputGUI::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();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
|
||||
XTRXOutput* m_XTRXOutput; //!< Same object as above but gives easy access to XTRXInput methods and attributes that are used intensively
|
||||
XTRXOutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
|
|
|
@ -116,3 +116,111 @@ bool XTRXOutputSettings::deserialize(const QByteArray& data)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
void XTRXOutputSettings::applySettings(const QStringList& settingsKeys, const XTRXOutputSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("log2HardInterp")) {
|
||||
m_log2HardInterp = settings.m_log2HardInterp;
|
||||
}
|
||||
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("ncoEnable")) {
|
||||
m_ncoEnable = settings.m_ncoEnable;
|
||||
}
|
||||
if (settingsKeys.contains("ncoFrequency")) {
|
||||
m_ncoFrequency = settings.m_ncoFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath")) {
|
||||
m_antennaPath = settings.m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("extClock")) {
|
||||
m_extClock = settings.m_extClock;
|
||||
}
|
||||
if (settingsKeys.contains("extClockFreq")) {
|
||||
m_extClockFreq = settings.m_extClockFreq;
|
||||
}
|
||||
if (settingsKeys.contains("pwrmode")) {
|
||||
m_pwrmode = settings.m_pwrmode;
|
||||
}
|
||||
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 XTRXOutputSettings::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("log2HardInterp") || force) {
|
||||
ostr << " m_log2HardInterp: " << m_log2HardInterp;
|
||||
}
|
||||
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("ncoEnable") || force) {
|
||||
ostr << " m_ncoEnable: " << m_ncoEnable;
|
||||
}
|
||||
if (settingsKeys.contains("ncoFrequency") || force) {
|
||||
ostr << " m_ncoFrequency: " << m_ncoFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath") || force) {
|
||||
ostr << " m_antennaPath: " << m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("extClock") || force) {
|
||||
ostr << " m_extClock: " << m_extClock;
|
||||
}
|
||||
if (settingsKeys.contains("extClockFreq") || force) {
|
||||
ostr << " m_extClockFreq: " << m_extClockFreq;
|
||||
}
|
||||
if (settingsKeys.contains("pwrmode") || force) {
|
||||
ostr << " m_pwrmode: " << m_pwrmode;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ struct XTRXOutputSettings
|
|||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const XTRXOutputSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESINK_XTRXOUTPUT_XTRXOUTPUTSETTINGS_H_ */
|
||||
|
|
Ładowanie…
Reference in New Issue