mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 10:38:45 -04:00
AFC feature: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
2b72cbab44
commit
f3c5cd0ab5
@ -118,7 +118,7 @@ void AFC::start()
|
||||
m_worker->setMessageQueueToGUI(getMessageQueueToGUI());
|
||||
m_thread->start();
|
||||
|
||||
AFCWorker::MsgConfigureAFCWorker *msg = AFCWorker::MsgConfigureAFCWorker::create(m_settings, true);
|
||||
AFCWorker::MsgConfigureAFCWorker *msg = AFCWorker::MsgConfigureAFCWorker::create(m_settings, QList<QString>(), true);
|
||||
m_worker->getInputMessageQueue()->push(msg);
|
||||
|
||||
m_state = StRunning;
|
||||
@ -146,7 +146,7 @@ bool AFC::handleMessage(const Message& cmd)
|
||||
{
|
||||
MsgConfigureAFC& cfg = (MsgConfigureAFC&) cmd;
|
||||
qDebug() << "AFC::handleMessage: MsgConfigureAFC";
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -225,70 +225,32 @@ bool AFC::deserialize(const QByteArray& data)
|
||||
{
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(m_settings, true);
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(m_settings, true);
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AFC::applySettings(const AFCSettings& settings, bool force)
|
||||
void AFC::applySettings(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "AFC::applySettings:"
|
||||
<< " m_title: " << settings.m_title
|
||||
<< " m_rgbColor: " << settings.m_rgbColor
|
||||
<< " m_trackerDeviceSetIndex: " << settings.m_trackerDeviceSetIndex
|
||||
<< " m_trackedDeviceSetIndex: " << settings.m_trackedDeviceSetIndex
|
||||
<< " m_hasTargetFrequency: " << settings.m_hasTargetFrequency
|
||||
<< " m_transverterTarget: " << settings.m_transverterTarget
|
||||
<< " m_targetFrequency: " << settings.m_targetFrequency
|
||||
<< " m_freqTolerance: " << settings.m_freqTolerance
|
||||
<< " m_trackerAdjustPeriod:" << settings.m_trackerAdjustPeriod
|
||||
<< " force: " << force;
|
||||
qDebug() << "AFC::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((m_settings.m_title != settings.m_title) || force) {
|
||||
reverseAPIKeys.append("title");
|
||||
}
|
||||
if ((m_settings.m_rgbColor != settings.m_rgbColor) || force) {
|
||||
reverseAPIKeys.append("rgbColor");
|
||||
}
|
||||
if ((m_settings.m_trackerDeviceSetIndex != settings.m_trackerDeviceSetIndex) || force) {
|
||||
reverseAPIKeys.append("trackerDeviceSetIndex");
|
||||
}
|
||||
if ((m_settings.m_trackedDeviceSetIndex != settings.m_trackedDeviceSetIndex) || force) {
|
||||
reverseAPIKeys.append("trackedDeviceSetIndex");
|
||||
}
|
||||
if ((m_settings.m_hasTargetFrequency != settings.m_hasTargetFrequency) || force) {
|
||||
reverseAPIKeys.append("hasTargetFrequency");
|
||||
}
|
||||
if ((m_settings.m_transverterTarget != settings.m_transverterTarget) || force) {
|
||||
reverseAPIKeys.append("transverterTarget");
|
||||
}
|
||||
if ((m_settings.m_targetFrequency != settings.m_targetFrequency) || force) {
|
||||
reverseAPIKeys.append("targetFrequency");
|
||||
}
|
||||
if ((m_settings.m_freqTolerance != settings.m_freqTolerance) || force) {
|
||||
reverseAPIKeys.append("freqTolerance");
|
||||
}
|
||||
if ((m_settings.m_trackerAdjustPeriod != settings.m_trackerAdjustPeriod) || force) {
|
||||
reverseAPIKeys.append("trackerAdjustPeriod");
|
||||
}
|
||||
|
||||
if ((m_settings.m_trackerDeviceSetIndex != settings.m_trackerDeviceSetIndex) || force)
|
||||
if (settingsKeys.contains("trackerDeviceSetIndex") || force)
|
||||
{
|
||||
removeTrackerFeatureReference();
|
||||
trackerDeviceChange(settings.m_trackerDeviceSetIndex);
|
||||
}
|
||||
|
||||
if ((m_settings.m_trackedDeviceSetIndex != settings.m_trackedDeviceSetIndex) || force)
|
||||
if (settingsKeys.contains("trackedDeviceSetIndex") || force)
|
||||
{
|
||||
removeTrackedFeatureReferences();
|
||||
trackedDeviceChange(settings.m_trackedDeviceSetIndex);
|
||||
@ -297,22 +259,27 @@ void AFC::applySettings(const AFCSettings& settings, bool force)
|
||||
if (m_running)
|
||||
{
|
||||
AFCWorker::MsgConfigureAFCWorker *msg = AFCWorker::MsgConfigureAFCWorker::create(
|
||||
settings, force
|
||||
settings, settingsKeys, force
|
||||
);
|
||||
m_worker->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
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_reverseAPIFeatureSetIndex != settings.m_reverseAPIFeatureSetIndex) ||
|
||||
(m_settings.m_reverseAPIFeatureIndex != settings.m_reverseAPIFeatureIndex);
|
||||
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIFeatureSetIndex") ||
|
||||
settingsKeys.contains("m_reverseAPIFeatureIndex");
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
void AFC::updateDeviceSetLists()
|
||||
@ -384,13 +351,13 @@ int AFC::webapiSettingsPutPatch(
|
||||
AFCSettings settings = m_settings;
|
||||
webapiUpdateFeatureSettings(settings, featureSettingsKeys, response);
|
||||
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(settings, force);
|
||||
MsgConfigureAFC *msg = MsgConfigureAFC::create(settings, featureSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
qDebug("AFC::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAFC *msgToGUI = MsgConfigureAFC::create(settings, force);
|
||||
MsgConfigureAFC *msgToGUI = MsgConfigureAFC::create(settings, featureSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -579,7 +546,7 @@ void AFC::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
|
||||
}
|
||||
}
|
||||
|
||||
void AFC::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const AFCSettings& settings, bool force)
|
||||
void AFC::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const AFCSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGFeatureSettings *swgFeatureSettings = new SWGSDRangel::SWGFeatureSettings();
|
||||
// swgFeatureSettings->setOriginatorFeatureIndex(getIndexInDeviceSet());
|
||||
|
@ -46,19 +46,22 @@ public:
|
||||
|
||||
public:
|
||||
const AFCSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureAFC* create(const AFCSettings& settings, bool force) {
|
||||
return new MsgConfigureAFC(settings, force);
|
||||
static MsgConfigureAFC* create(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureAFC(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
AFCSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureAFC(const AFCSettings& settings, bool force) :
|
||||
MsgConfigureAFC(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -218,9 +221,9 @@ private:
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void applySettings(const AFCSettings& settings, bool force = false);
|
||||
void applySettings(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const AFCSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& featureSettingsKeys, const AFCSettings& settings, bool force);
|
||||
void trackerDeviceChange(int deviceIndex);
|
||||
void trackedDeviceChange(int deviceIndex);
|
||||
void removeTrackerFeatureReference();
|
||||
|
@ -72,7 +72,13 @@ bool AFCGUI::handleMessage(const Message& message)
|
||||
{
|
||||
qDebug("AFCGUI::handleMessage: AFC::MsgConfigureAFC");
|
||||
const AFC::MsgConfigureAFC& cfg = (AFC::MsgConfigureAFC&) 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);
|
||||
@ -258,6 +264,8 @@ void AFCGUI::updateDeviceSetLists(const AFC::MsgDeviceSetListsReport& report)
|
||||
qDebug("AFCGUI::updateDeviceSetLists: device index changed: %d:%d", trackerDeviceIndex, trackedDeviceIndex);
|
||||
m_settings.m_trackerDeviceSetIndex = trackerDeviceIndex;
|
||||
m_settings.m_trackedDeviceSetIndex = trackedDeviceIndex;
|
||||
m_settingsKeys.append("trackerDeviceSetIndex");
|
||||
m_settingsKeys.append("trackedDeviceSetIndex");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -291,6 +299,12 @@ void AFCGUI::onMenuDialogCalled(const QPoint &p)
|
||||
setTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIFeatureSetIndex");
|
||||
m_settingsKeys.append("reverseAPIFeatureIndex");
|
||||
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -309,18 +323,21 @@ void AFCGUI::on_startStop_toggled(bool checked)
|
||||
void AFCGUI::on_hasTargetFrequency_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_hasTargetFrequency = checked;
|
||||
m_settingsKeys.append("hasTargetFrequency");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AFCGUI::on_targetFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_targetFrequency = value;
|
||||
m_settingsKeys.append("targetFrequency");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AFCGUI::on_transverterTarget_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_transverterTarget = checked;
|
||||
m_settingsKeys.append("transverterTarget");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -328,6 +345,7 @@ void AFCGUI::on_transverterTarget_toggled(bool checked)
|
||||
void AFCGUI::on_toleranceFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_freqTolerance = value;
|
||||
m_settingsKeys.append("freqTolerance");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -347,6 +365,7 @@ void AFCGUI::on_trackerDevice_currentIndexChanged(int index)
|
||||
if (index >= 0)
|
||||
{
|
||||
m_settings.m_trackerDeviceSetIndex = index;
|
||||
m_settingsKeys.append("trackerDeviceSetIndex");
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
@ -356,6 +375,7 @@ void AFCGUI::on_trackedDevice_currentIndexChanged(int index)
|
||||
if (index >= 0)
|
||||
{
|
||||
m_settings.m_trackedDeviceSetIndex = index;
|
||||
m_settingsKeys.append("trackedDeviceSetIndex");
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
@ -370,6 +390,7 @@ void AFCGUI::on_targetPeriod_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_trackerAdjustPeriod = value;
|
||||
ui->targetPeriodText->setText(tr("%1").arg(m_settings.m_trackerAdjustPeriod));
|
||||
m_settingsKeys.append("trackerAdjustPeriod");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -411,7 +432,7 @@ void AFCGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
AFC::MsgConfigureAFC* message = AFC::MsgConfigureAFC::create( m_settings, force);
|
||||
AFC::MsgConfigureAFC* message = AFC::MsgConfigureAFC::create( m_settings, m_settingsKeys, force);
|
||||
m_afc->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ private:
|
||||
PluginAPI* m_pluginAPI;
|
||||
FeatureUISet* m_featureUISet;
|
||||
AFCSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
RollupState m_rollupState;
|
||||
bool m_doApplySettings;
|
||||
|
||||
|
@ -133,3 +133,105 @@ bool AFCSettings::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AFCSettings::applySettings(const QStringList& settingsKeys, const AFCSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("title")) {
|
||||
m_title = settings.m_title;
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor")) {
|
||||
m_rgbColor = settings.m_rgbColor;
|
||||
}
|
||||
if (settingsKeys.contains("trackerDeviceSetIndex")) {
|
||||
m_trackerDeviceSetIndex = settings.m_trackerDeviceSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("trackedDeviceSetIndex")) {
|
||||
m_trackedDeviceSetIndex = settings.m_trackedDeviceSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("hasTargetFrequency")) {
|
||||
m_hasTargetFrequency = settings.m_hasTargetFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("transverterTarget")) {
|
||||
m_transverterTarget = settings.m_transverterTarget;
|
||||
}
|
||||
if (settingsKeys.contains("targetFrequency")) {
|
||||
m_targetFrequency = settings.m_targetFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("freqTolerance")) {
|
||||
m_freqTolerance = settings.m_freqTolerance;
|
||||
}
|
||||
if (settingsKeys.contains("trackerAdjustPeriod")) {
|
||||
m_trackerAdjustPeriod = settings.m_trackerAdjustPeriod;
|
||||
}
|
||||
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("reverseAPIFeatureSetIndex")) {
|
||||
m_reverseAPIFeatureSetIndex = settings.m_reverseAPIFeatureSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIFeatureIndex")) {
|
||||
m_reverseAPIFeatureIndex = settings.m_reverseAPIFeatureIndex;
|
||||
}
|
||||
if (settingsKeys.contains("workspaceIndex")) {
|
||||
m_workspaceIndex = settings.m_workspaceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
QString AFCSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("title") || force) {
|
||||
ostr << " m_title: " << m_title.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor") || force) {
|
||||
ostr << " m_rgbColor: " << m_rgbColor;
|
||||
}
|
||||
if (settingsKeys.contains("trackerDeviceSetIndex") || force) {
|
||||
ostr << " m_trackerDeviceSetIndex: " << m_trackerDeviceSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("trackedDeviceSetIndex") || force) {
|
||||
ostr << " m_trackedDeviceSetIndex: " << m_trackedDeviceSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("hasTargetFrequency") || force) {
|
||||
ostr << " m_hasTargetFrequency: " << m_hasTargetFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("transverterTarget") || force) {
|
||||
ostr << " m_transverterTarget: " << m_transverterTarget;
|
||||
}
|
||||
if (settingsKeys.contains("targetFrequency") || force) {
|
||||
ostr << " m_targetFrequency: " << m_targetFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("freqTolerance") || force) {
|
||||
ostr << " m_freqTolerance: " << m_freqTolerance;
|
||||
}
|
||||
if (settingsKeys.contains("trackerAdjustPeriod") || force) {
|
||||
ostr << " m_trackerAdjustPeriod: " << m_trackerAdjustPeriod;
|
||||
}
|
||||
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("reverseAPIFeatureSetIndex") || force) {
|
||||
ostr << " m_reverseAPIFeatureSetIndex: " << m_reverseAPIFeatureSetIndex;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIFeatureIndex") || force) {
|
||||
ostr << " m_reverseAPIFeatureIndex: " << m_reverseAPIFeatureIndex;
|
||||
}
|
||||
if (settingsKeys.contains("workspaceIndex") || force) {
|
||||
ostr << " m_workspaceIndex: " << m_workspaceIndex;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ struct AFCSettings
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||
void applySettings(const QStringList& settingsKeys, const AFCSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_FEATURE_AFCSETTINGS_H_
|
||||
|
@ -99,7 +99,7 @@ bool AFCWorker::handleMessage(const Message& cmd)
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
MsgConfigureAFCWorker& cfg = (MsgConfigureAFCWorker&) cmd;
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -135,32 +135,23 @@ bool AFCWorker::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void AFCWorker::applySettings(const AFCSettings& settings, bool force)
|
||||
void AFCWorker::applySettings(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "AFCWorker::applySettings:"
|
||||
<< " m_title: " << settings.m_title
|
||||
<< " m_rgbColor: " << settings.m_rgbColor
|
||||
<< " m_trackerDeviceSetIndex: " << settings.m_trackerDeviceSetIndex
|
||||
<< " m_trackedDeviceSetIndex: " << settings.m_trackedDeviceSetIndex
|
||||
<< " m_hasTargetFrequency: " << settings.m_hasTargetFrequency
|
||||
<< " m_transverterTarget: " << settings.m_transverterTarget
|
||||
<< " m_targetFrequency: " << settings.m_targetFrequency
|
||||
<< " m_freqTolerance: " << settings.m_freqTolerance
|
||||
<< " force: " << force;
|
||||
qDebug() << "AFCWorker::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force;
|
||||
|
||||
if ((settings.m_trackerDeviceSetIndex != m_settings.m_trackerDeviceSetIndex) || force) {
|
||||
if (settingsKeys.contains("trackerDeviceSetIndex") || force) {
|
||||
initTrackerDeviceSet(settings.m_trackerDeviceSetIndex);
|
||||
}
|
||||
|
||||
if ((settings.m_trackedDeviceSetIndex != m_settings.m_trackedDeviceSetIndex) || force) {
|
||||
if (settingsKeys.contains("trackedDeviceSetIndex") || force) {
|
||||
initTrackedDeviceSet(settings.m_trackedDeviceSetIndex);
|
||||
}
|
||||
|
||||
if ((settings.m_trackerAdjustPeriod != m_settings.m_trackerAdjustPeriod) || force) {
|
||||
if (settingsKeys.contains("trackerAdjustPeriod") || force) {
|
||||
m_updateTimer.setInterval(settings.m_trackerAdjustPeriod * 1000);
|
||||
}
|
||||
|
||||
if ((settings.m_hasTargetFrequency != m_settings.m_hasTargetFrequency) || force)
|
||||
if (settingsKeys.contains("hasTargetFrequency") || force)
|
||||
{
|
||||
if (settings.m_hasTargetFrequency) {
|
||||
m_updateTimer.start(m_settings.m_trackerAdjustPeriod * 1000);
|
||||
|
@ -40,20 +40,23 @@ public:
|
||||
|
||||
public:
|
||||
const AFCSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureAFCWorker* create(const AFCSettings& settings, bool force)
|
||||
static MsgConfigureAFCWorker* create(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigureAFCWorker(settings, force);
|
||||
return new MsgConfigureAFCWorker(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
AFCSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureAFCWorker(const AFCSettings& settings, bool force) :
|
||||
MsgConfigureAFCWorker(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -154,7 +157,7 @@ private:
|
||||
QRecursiveMutex m_mutex;
|
||||
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const AFCSettings& settings, bool force = false);
|
||||
void applySettings(const AFCSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void initTrackerDeviceSet(int deviceSetIndex);
|
||||
void initTrackedDeviceSet(int deviceSetIndex);
|
||||
void processChannelSettings(
|
||||
|
Loading…
Reference in New Issue
Block a user