mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	Remote Input: Make settings assignments atomic. Part of #1329
This commit is contained in:
		
							parent
							
								
									1e1434e1a5
								
							
						
					
					
						commit
						68c534f848
					
				@ -92,7 +92,7 @@ void RemoteInput::destroy()
 | 
			
		||||
 | 
			
		||||
void RemoteInput::init()
 | 
			
		||||
{
 | 
			
		||||
    applySettings(m_settings, true);
 | 
			
		||||
    applySettings(m_settings, QList<QString>(), true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool RemoteInput::start()
 | 
			
		||||
@ -122,12 +122,12 @@ bool RemoteInput::deserialize(const QByteArray& data)
 | 
			
		||||
        success = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    MsgConfigureRemoteInput* message = MsgConfigureRemoteInput::create(m_settings, true);
 | 
			
		||||
    MsgConfigureRemoteInput* message = MsgConfigureRemoteInput::create(m_settings, QList<QString>(), true);
 | 
			
		||||
    m_inputMessageQueue.push(message);
 | 
			
		||||
 | 
			
		||||
    if (m_guiMessageQueue)
 | 
			
		||||
    {
 | 
			
		||||
        MsgConfigureRemoteInput* messageToGUI = MsgConfigureRemoteInput::create(m_settings, true);
 | 
			
		||||
        MsgConfigureRemoteInput* messageToGUI = MsgConfigureRemoteInput::create(m_settings, QList<QString>(), true);
 | 
			
		||||
        m_guiMessageQueue->push(messageToGUI);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -211,8 +211,7 @@ bool RemoteInput::handleMessage(const Message& message)
 | 
			
		||||
 | 
			
		||||
        if (cmd.getStartStop())
 | 
			
		||||
        {
 | 
			
		||||
            if (m_deviceAPI->initDeviceEngine())
 | 
			
		||||
            {
 | 
			
		||||
            if (m_deviceAPI->initDeviceEngine()) {
 | 
			
		||||
                m_deviceAPI->startDeviceEngine();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -231,7 +230,7 @@ bool RemoteInput::handleMessage(const Message& message)
 | 
			
		||||
    {
 | 
			
		||||
        qDebug() << "RemoteInput::handleMessage:" << message.getIdentifier();
 | 
			
		||||
        MsgConfigureRemoteInput& conf = (MsgConfigureRemoteInput&) message;
 | 
			
		||||
        applySettings(conf.getSettings(), conf.getForce());
 | 
			
		||||
        applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    else if (MsgConfigureRemoteChannel::match(message))
 | 
			
		||||
@ -261,40 +260,15 @@ bool RemoteInput::handleMessage(const Message& message)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RemoteInput::applySettings(const RemoteInputSettings& settings, bool force)
 | 
			
		||||
void RemoteInput::applySettings(const RemoteInputSettings& settings, const QList<QString>& settingsKeys, bool force)
 | 
			
		||||
{
 | 
			
		||||
    qDebug() << "RemoteInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
 | 
			
		||||
    QMutexLocker mutexLocker(&m_mutex);
 | 
			
		||||
    std::ostringstream os;
 | 
			
		||||
    QString remoteAddress;
 | 
			
		||||
    m_remoteInputUDPHandler->getRemoteAddress(remoteAddress);
 | 
			
		||||
    QList<QString> reverseAPIKeys;
 | 
			
		||||
 | 
			
		||||
    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_dataAddress != settings.m_dataAddress) || force) {
 | 
			
		||||
        reverseAPIKeys.append("dataAddress");
 | 
			
		||||
    }
 | 
			
		||||
    if ((m_settings.m_dataPort != settings.m_dataPort) || force) {
 | 
			
		||||
        reverseAPIKeys.append("dataPort");
 | 
			
		||||
    }
 | 
			
		||||
    if ((m_settings.m_apiAddress != settings.m_apiAddress) || force) {
 | 
			
		||||
        reverseAPIKeys.append("apiAddress");
 | 
			
		||||
    }
 | 
			
		||||
    if ((m_settings.m_apiPort != settings.m_apiPort) || force) {
 | 
			
		||||
        reverseAPIKeys.append("apiPort");
 | 
			
		||||
    }
 | 
			
		||||
    if ((m_settings.m_multicastAddress != settings.m_multicastAddress) || force) {
 | 
			
		||||
        reverseAPIKeys.append("multicastAddress");
 | 
			
		||||
    }
 | 
			
		||||
    if ((m_settings.m_multicastJoin != settings.m_multicastJoin) || force) {
 | 
			
		||||
        reverseAPIKeys.append("multicastJoin");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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);
 | 
			
		||||
        qDebug("RemoteInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
 | 
			
		||||
@ -302,10 +276,10 @@ void RemoteInput::applySettings(const RemoteInputSettings& settings, bool force)
 | 
			
		||||
                settings.m_iqCorrection ? "true" : "false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((m_settings.m_dataAddress != settings.m_dataAddress) ||
 | 
			
		||||
        (m_settings.m_dataPort != settings.m_dataPort) ||
 | 
			
		||||
        (m_settings.m_multicastAddress != settings.m_multicastAddress) ||
 | 
			
		||||
        (m_settings.m_multicastJoin != settings.m_multicastJoin) || force)
 | 
			
		||||
    if (settingsKeys.contains("dataAddress") ||
 | 
			
		||||
        settingsKeys.contains("dataPort") ||
 | 
			
		||||
        settingsKeys.contains("multicastAddress") ||
 | 
			
		||||
        settingsKeys.contains("multicastJoin") || force)
 | 
			
		||||
    {
 | 
			
		||||
        m_remoteInputUDPHandler->configureUDPLink(settings.m_dataAddress, settings.m_dataPort, settings.m_multicastAddress, settings.m_multicastJoin);
 | 
			
		||||
        m_remoteInputUDPHandler->getRemoteAddress(remoteAddress);
 | 
			
		||||
@ -313,26 +287,22 @@ void RemoteInput::applySettings(const RemoteInputSettings& settings, bool force)
 | 
			
		||||
 | 
			
		||||
    mutexLocker.unlock();
 | 
			
		||||
 | 
			
		||||
    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;
 | 
			
		||||
    m_remoteAddress = remoteAddress;
 | 
			
		||||
    if (force) {
 | 
			
		||||
        m_settings = settings;
 | 
			
		||||
    } else {
 | 
			
		||||
        m_settings.applySettings(settingsKeys, settings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug() << "RemoteInput::applySettings: "
 | 
			
		||||
        << " m_dataAddress: " << m_settings.m_dataAddress
 | 
			
		||||
        << " m_dataPort: " << m_settings.m_dataPort
 | 
			
		||||
        << " m_multicastAddress: " << m_settings.m_multicastAddress
 | 
			
		||||
        << " m_multicastJoin: " << m_settings.m_multicastJoin
 | 
			
		||||
        << " m_apiAddress: " << m_settings.m_apiAddress
 | 
			
		||||
        << " m_apiPort: " << m_settings.m_apiPort
 | 
			
		||||
        << " m_remoteAddress: " << m_remoteAddress;
 | 
			
		||||
    m_remoteAddress = remoteAddress;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RemoteInput::applyRemoteChannelSettings(const RemoteChannelSettings& settings)
 | 
			
		||||
@ -445,12 +415,12 @@ int RemoteInput::webapiSettingsPutPatch(
 | 
			
		||||
    RemoteInputSettings settings = m_settings;
 | 
			
		||||
    webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
 | 
			
		||||
 | 
			
		||||
    MsgConfigureRemoteInput *msg = MsgConfigureRemoteInput::create(settings, force);
 | 
			
		||||
    MsgConfigureRemoteInput *msg = MsgConfigureRemoteInput::create(settings, deviceSettingsKeys, force);
 | 
			
		||||
    m_inputMessageQueue.push(msg);
 | 
			
		||||
 | 
			
		||||
    if (m_guiMessageQueue) // forward to GUI if any
 | 
			
		||||
    {
 | 
			
		||||
        MsgConfigureRemoteInput *msgToGUI = MsgConfigureRemoteInput::create(settings, force);
 | 
			
		||||
        MsgConfigureRemoteInput *msgToGUI = MsgConfigureRemoteInput::create(settings, deviceSettingsKeys, force);
 | 
			
		||||
        m_guiMessageQueue->push(msgToGUI);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -548,7 +518,7 @@ void RemoteInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respons
 | 
			
		||||
    response.getRemoteInputReport()->setMaxNbRecovery(m_remoteInputUDPHandler->getMaxNbRecovery());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RemoteInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteInputSettings& settings, bool force)
 | 
			
		||||
void RemoteInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteInputSettings& settings, bool force)
 | 
			
		||||
{
 | 
			
		||||
    SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
 | 
			
		||||
    swgDeviceSettings->setDirection(0); // single Rx
 | 
			
		||||
 | 
			
		||||
@ -60,20 +60,23 @@ public:
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        const RemoteInputSettings& getSettings() const { return m_settings; }
 | 
			
		||||
        const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
 | 
			
		||||
        bool getForce() const { return m_force; }
 | 
			
		||||
 | 
			
		||||
        static MsgConfigureRemoteInput* create(const RemoteInputSettings& settings, bool force = false)
 | 
			
		||||
        static MsgConfigureRemoteInput* create(const RemoteInputSettings& settings, const QList<QString>& settingsKeys, bool force = false)
 | 
			
		||||
        {
 | 
			
		||||
            return new MsgConfigureRemoteInput(settings, force);
 | 
			
		||||
            return new MsgConfigureRemoteInput(settings, settingsKeys, force);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    private:
 | 
			
		||||
        RemoteInputSettings m_settings;
 | 
			
		||||
        QList<QString> m_settingsKeys;
 | 
			
		||||
        bool m_force;
 | 
			
		||||
 | 
			
		||||
        MsgConfigureRemoteInput(const RemoteInputSettings& settings, bool force) :
 | 
			
		||||
        MsgConfigureRemoteInput(const RemoteInputSettings& settings, const QList<QString>& settingsKeys, bool force) :
 | 
			
		||||
            Message(),
 | 
			
		||||
            m_settings(settings),
 | 
			
		||||
            m_settingsKeys(settingsKeys),
 | 
			
		||||
            m_force(force)
 | 
			
		||||
        { }
 | 
			
		||||
    };
 | 
			
		||||
@ -414,10 +417,10 @@ private:
 | 
			
		||||
    QNetworkAccessManager *m_networkManager;
 | 
			
		||||
    QNetworkRequest m_networkRequest;
 | 
			
		||||
 | 
			
		||||
    void applySettings(const RemoteInputSettings& settings, bool force = false);
 | 
			
		||||
    void applySettings(const RemoteInputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
 | 
			
		||||
    void applyRemoteChannelSettings(const RemoteChannelSettings& settings);
 | 
			
		||||
    void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
 | 
			
		||||
    void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RemoteInputSettings& settings, bool force);
 | 
			
		||||
    void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RemoteInputSettings& settings, bool force);
 | 
			
		||||
    void webapiReverseSendStartStop(bool start);
 | 
			
		||||
    void analyzeRemoteChannelSettingsReply(const QJsonObject& jsonObject);
 | 
			
		||||
    void analyzeInstanceSummaryReply(const QJsonObject& jsonObject);
 | 
			
		||||
 | 
			
		||||
@ -163,7 +163,13 @@ bool RemoteInputGui::handleMessage(const Message& message)
 | 
			
		||||
    if (RemoteInput::MsgConfigureRemoteInput::match(message))
 | 
			
		||||
    {
 | 
			
		||||
        const RemoteInput::MsgConfigureRemoteInput& cfg = (RemoteInput::MsgConfigureRemoteInput&) 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);
 | 
			
		||||
@ -278,8 +284,7 @@ void RemoteInputGui::handleInputMessages()
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            if (handleMessage(*message))
 | 
			
		||||
            {
 | 
			
		||||
            if (handleMessage(*message)) {
 | 
			
		||||
                delete message;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -400,11 +405,14 @@ void RemoteInputGui::on_apiApplyButton_clicked(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    (void) checked;
 | 
			
		||||
    m_settings.m_apiAddress = ui->apiAddress->text();
 | 
			
		||||
    m_settingsKeys.append("apiAddress");
 | 
			
		||||
 | 
			
		||||
    bool ctlOk;
 | 
			
		||||
    int udpApiPort = ui->apiPort->text().toInt(&ctlOk);
 | 
			
		||||
 | 
			
		||||
    if((ctlOk) && (udpApiPort >= 1024) && (udpApiPort < 65535)) {
 | 
			
		||||
    if((ctlOk) && (udpApiPort >= 1024) && (udpApiPort < 65535))
 | 
			
		||||
    {
 | 
			
		||||
        m_settingsKeys.append("apiPort");
 | 
			
		||||
        m_settings.m_apiPort = udpApiPort;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -428,6 +436,7 @@ void RemoteInputGui::on_dataApplyButton_clicked(bool checked)
 | 
			
		||||
void RemoteInputGui::on_apiAddress_editingFinished()
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_apiAddress = ui->apiAddress->text();
 | 
			
		||||
    m_settingsKeys.append("apiAddress");
 | 
			
		||||
 | 
			
		||||
    ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
 | 
			
		||||
    RemoteInput::MsgRequestFixedData *msg = RemoteInput::MsgRequestFixedData::create();
 | 
			
		||||
@ -439,6 +448,7 @@ void RemoteInputGui::on_apiAddress_editingFinished()
 | 
			
		||||
void RemoteInputGui::on_dataAddress_editingFinished()
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_dataAddress = ui->dataAddress->text();
 | 
			
		||||
    m_settingsKeys.append("dataAddress");
 | 
			
		||||
    ui->dataApplyButton->setEnabled(true);
 | 
			
		||||
    ui->dataApplyButton->setStyleSheet("QPushButton { background-color : green; }");
 | 
			
		||||
}
 | 
			
		||||
@ -453,6 +463,7 @@ void RemoteInputGui::on_dataPort_editingFinished()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m_settings.m_dataPort = udpPort;
 | 
			
		||||
    m_settingsKeys.append("dataPort");
 | 
			
		||||
    ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
 | 
			
		||||
 | 
			
		||||
    ui->dataApplyButton->setEnabled(true);
 | 
			
		||||
@ -462,6 +473,7 @@ void RemoteInputGui::on_dataPort_editingFinished()
 | 
			
		||||
void RemoteInputGui::on_multicastAddress_editingFinished()
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_multicastAddress = ui->multicastAddress->text();
 | 
			
		||||
    m_settingsKeys.append("multicastAddress");
 | 
			
		||||
    ui->dataApplyButton->setEnabled(true);
 | 
			
		||||
    ui->dataApplyButton->setStyleSheet("QPushButton { background-color : green; }");
 | 
			
		||||
}
 | 
			
		||||
@ -469,6 +481,7 @@ void RemoteInputGui::on_multicastAddress_editingFinished()
 | 
			
		||||
void RemoteInputGui::on_multicastJoin_toggled(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_multicastJoin = checked;
 | 
			
		||||
    m_settingsKeys.append("multicastJoin");
 | 
			
		||||
    ui->dataApplyButton->setEnabled(true);
 | 
			
		||||
    ui->dataApplyButton->setStyleSheet("QPushButton { background-color : green; }");
 | 
			
		||||
}
 | 
			
		||||
@ -485,7 +498,7 @@ void RemoteInputGui::on_apiPort_editingFinished()
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        m_settings.m_apiPort = udpApiPort;
 | 
			
		||||
 | 
			
		||||
        m_settingsKeys.append("apiPort");
 | 
			
		||||
        ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
 | 
			
		||||
        RemoteInput::MsgRequestFixedData *msg = RemoteInput::MsgRequestFixedData::create();
 | 
			
		||||
        m_sampleSource->getInputMessageQueue()->push(msg);
 | 
			
		||||
@ -497,12 +510,14 @@ void RemoteInputGui::on_apiPort_editingFinished()
 | 
			
		||||
void RemoteInputGui::on_dcOffset_toggled(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_dcBlock = checked;
 | 
			
		||||
    m_settingsKeys.append("dcBlock");
 | 
			
		||||
    sendSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RemoteInputGui::on_iqImbalance_toggled(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_iqCorrection = checked;
 | 
			
		||||
    m_settingsKeys.append("iqCorrection");
 | 
			
		||||
    sendSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -620,9 +635,10 @@ void RemoteInputGui::updateHardware()
 | 
			
		||||
    {
 | 
			
		||||
        qDebug() << "RemoteInputGui::updateHardware";
 | 
			
		||||
        RemoteInput::MsgConfigureRemoteInput* message =
 | 
			
		||||
                RemoteInput::MsgConfigureRemoteInput::create(m_settings, m_forceSettings);
 | 
			
		||||
                RemoteInput::MsgConfigureRemoteInput::create(m_settings, m_settingsKeys, m_forceSettings);
 | 
			
		||||
        m_sampleSource->getInputMessageQueue()->push(message);
 | 
			
		||||
        m_forceSettings = false;
 | 
			
		||||
        m_settingsKeys.clear();
 | 
			
		||||
        m_updateTimer.stop();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -696,6 +712,10 @@ void RemoteInputGui::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();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,7 @@ private:
 | 
			
		||||
	Ui::RemoteInputGui* ui;
 | 
			
		||||
 | 
			
		||||
    RemoteInputSettings m_settings;        //!< current settings
 | 
			
		||||
    QList<QString> m_settingsKeys;
 | 
			
		||||
	RemoteInput::RemoteChannelSettings m_remoteChannelSettings;
 | 
			
		||||
	double m_remoteShiftFrequencyFactor;  //!< Remote channel frequency shift factor
 | 
			
		||||
	RemoteInput* m_sampleSource;
 | 
			
		||||
 | 
			
		||||
@ -105,5 +105,87 @@ bool RemoteInputSettings::deserialize(const QByteArray& data)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RemoteInputSettings::applySettings(const QStringList& settingsKeys, const RemoteInputSettings& settings)
 | 
			
		||||
{
 | 
			
		||||
    if (settingsKeys.contains("apiAddress")) {
 | 
			
		||||
        m_apiAddress = settings.m_apiAddress;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("apiPort")) {
 | 
			
		||||
        m_apiPort = settings.m_apiPort;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dataAddress")) {
 | 
			
		||||
        m_dataAddress = settings.m_dataAddress;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dataPort")) {
 | 
			
		||||
        m_dataPort = settings.m_dataPort;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("multicastAddress")) {
 | 
			
		||||
        m_multicastAddress = settings.m_multicastAddress;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("multicastJoin")) {
 | 
			
		||||
        m_multicastJoin = settings.m_multicastJoin;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dcBlock")) {
 | 
			
		||||
        m_dcBlock = settings.m_dcBlock;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("iqCorrection")) {
 | 
			
		||||
        m_iqCorrection = settings.m_iqCorrection;
 | 
			
		||||
    }
 | 
			
		||||
    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 RemoteInputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
 | 
			
		||||
{
 | 
			
		||||
    std::ostringstream ostr;
 | 
			
		||||
 | 
			
		||||
    if (settingsKeys.contains("apiAddress") || force) {
 | 
			
		||||
        ostr << " m_apiAddress: " << m_apiAddress.toStdString();
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("apiPort") || force) {
 | 
			
		||||
        ostr << " m_apiPort: " << m_apiPort;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dataAddress") || force) {
 | 
			
		||||
        ostr << " m_dataAddress: " << m_dataAddress.toStdString();
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dataPort") || force) {
 | 
			
		||||
        ostr << " m_dataPort: " << m_dataPort;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("multicastAddress") || force) {
 | 
			
		||||
        ostr << " m_multicastAddress: " << m_multicastAddress.toStdString();
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("multicastJoin") || force) {
 | 
			
		||||
        ostr << " m_multicastJoin: " << m_multicastJoin;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("dcBlock") || force) {
 | 
			
		||||
        ostr << " m_dcBlock: " << m_dcBlock;
 | 
			
		||||
    }
 | 
			
		||||
    if (settingsKeys.contains("iqCorrection") || force) {
 | 
			
		||||
        ostr << " m_iqCorrection: " << m_iqCorrection;
 | 
			
		||||
    }
 | 
			
		||||
    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());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -39,6 +39,8 @@ struct RemoteInputSettings {
 | 
			
		||||
    void resetToDefaults();
 | 
			
		||||
    QByteArray serialize() const;
 | 
			
		||||
    bool deserialize(const QByteArray& data);
 | 
			
		||||
    void applySettings(const QStringList& settingsKeys, const RemoteInputSettings& settings);
 | 
			
		||||
    QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif /* PLUGINS_SAMPLESOURCE_REMOTEINPUT_REMOTEINPUTSETTINGS_H_ */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user