mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
PER Tester feature: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
d5d2ae1ebd
commit
ba1dfa97f3
@ -91,7 +91,7 @@ void PERTester::start()
|
||||
|
||||
m_worker->setMessageQueueToFeature(getInputMessageQueue());
|
||||
m_worker->setMessageQueueToGUI(getMessageQueueToGUI());
|
||||
m_worker->getInputMessageQueue()->push(PERTesterWorker::MsgConfigurePERTesterWorker::create(m_settings, true));
|
||||
m_worker->getInputMessageQueue()->push(PERTesterWorker::MsgConfigurePERTesterWorker::create(m_settings, QList<QString>(), true));
|
||||
if (m_settings.m_start == PERTesterSettings::START_IMMEDIATELY)
|
||||
{
|
||||
m_thread->start();
|
||||
@ -124,7 +124,7 @@ bool PERTester::handleMessage(const Message& cmd)
|
||||
{
|
||||
MsgConfigurePERTester& cfg = (MsgConfigurePERTester&) cmd;
|
||||
qDebug() << "PERTester::handleMessage: MsgConfigurePERTester";
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -177,100 +177,38 @@ bool PERTester::deserialize(const QByteArray& data)
|
||||
{
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(m_settings, true);
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(m_settings, true);
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PERTester::applySettings(const PERTesterSettings& settings, bool force)
|
||||
void PERTester::applySettings(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "PERTester::applySettings:"
|
||||
<< " m_packetCount: " << settings.m_packetCount
|
||||
<< " m_interval: " << settings.m_interval
|
||||
<< " m_start: " << settings.m_start
|
||||
<< " m_satellites: " << settings.m_satellites
|
||||
<< " m_packet: " << settings.m_packet
|
||||
<< " m_ignoreLeadingBytes: " << settings.m_ignoreLeadingBytes
|
||||
<< " m_ignoreTrailingBytes: " << settings.m_ignoreTrailingBytes
|
||||
<< " m_txUDPAddress: " << settings.m_txUDPAddress
|
||||
<< " m_txUDPPort: " << settings.m_txUDPPort
|
||||
<< " m_rxUDPAddress: " << settings.m_rxUDPAddress
|
||||
<< " m_rxUDPPort: " << settings.m_rxUDPPort
|
||||
<< " m_title: " << settings.m_title
|
||||
<< " m_rgbColor: " << settings.m_rgbColor
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
||||
<< " m_reverseAPIFeatureSetIndex: " << settings.m_reverseAPIFeatureSetIndex
|
||||
<< " m_reverseAPIFeatureIndex: " << settings.m_reverseAPIFeatureIndex
|
||||
<< " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((m_settings.m_packetCount != settings.m_packetCount) || force) {
|
||||
reverseAPIKeys.append("packetCount");
|
||||
}
|
||||
if ((m_settings.m_interval != settings.m_interval) || force) {
|
||||
reverseAPIKeys.append("interval");
|
||||
}
|
||||
if ((m_settings.m_start != settings.m_start) || force) {
|
||||
reverseAPIKeys.append("start");
|
||||
}
|
||||
if ((m_settings.m_satellites != settings.m_satellites) || force) {
|
||||
reverseAPIKeys.append("satellites");
|
||||
}
|
||||
if ((m_settings.m_packet != settings.m_packet) || force) {
|
||||
reverseAPIKeys.append("packet");
|
||||
}
|
||||
if ((m_settings.m_ignoreLeadingBytes != settings.m_ignoreLeadingBytes) || force) {
|
||||
reverseAPIKeys.append("ignoreLeadingBytes");
|
||||
}
|
||||
if ((m_settings.m_ignoreTrailingBytes != settings.m_ignoreTrailingBytes) || force) {
|
||||
reverseAPIKeys.append("ignoreTrailingBytes");
|
||||
}
|
||||
if ((m_settings.m_txUDPAddress != settings.m_txUDPAddress) || force) {
|
||||
reverseAPIKeys.append("txUDPAddress");
|
||||
}
|
||||
if ((m_settings.m_txUDPPort != settings.m_txUDPPort) || force) {
|
||||
reverseAPIKeys.append("txUDPPort");
|
||||
}
|
||||
if ((m_settings.m_rxUDPAddress != settings.m_rxUDPAddress) || force) {
|
||||
reverseAPIKeys.append("rxUDPAddress");
|
||||
}
|
||||
if ((m_settings.m_rxUDPPort != settings.m_rxUDPPort) || force) {
|
||||
reverseAPIKeys.append("rxUDPPort");
|
||||
}
|
||||
|
||||
if ((m_settings.m_title != settings.m_title) || force) {
|
||||
reverseAPIKeys.append("title");
|
||||
}
|
||||
if ((m_settings.m_rgbColor != settings.m_rgbColor) || force) {
|
||||
reverseAPIKeys.append("rgbColor");
|
||||
}
|
||||
qDebug() << "PERTester::applySettings:" << settings.getDebugString(settingsKeys, force) << " force: " << force;
|
||||
|
||||
PERTesterWorker::MsgConfigurePERTesterWorker *msg = PERTesterWorker::MsgConfigurePERTesterWorker::create(
|
||||
settings, force
|
||||
settings, settingsKeys, force
|
||||
);
|
||||
if (m_worker) {
|
||||
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);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIFeatureSetIndex") ||
|
||||
settingsKeys.contains("m_reverseAPIFeatureIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
@ -308,12 +246,12 @@ int PERTester::webapiSettingsPutPatch(
|
||||
PERTesterSettings settings = m_settings;
|
||||
webapiUpdateFeatureSettings(settings, featureSettingsKeys, response);
|
||||
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(settings, force);
|
||||
MsgConfigurePERTester *msg = MsgConfigurePERTester::create(settings, featureSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePERTester *msgToGUI = MsgConfigurePERTester::create(settings, force);
|
||||
MsgConfigurePERTester *msgToGUI = MsgConfigurePERTester::create(settings, featureSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -448,7 +386,7 @@ void PERTester::webapiUpdateFeatureSettings(
|
||||
}
|
||||
}
|
||||
|
||||
void PERTester::webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const PERTesterSettings& settings, bool force)
|
||||
void PERTester::webapiReverseSendSettings(const QList<QString>& featureSettingsKeys, const PERTesterSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGFeatureSettings *swgFeatureSettings = new SWGSDRangel::SWGFeatureSettings();
|
||||
// swgFeatureSettings->setOriginatorFeatureIndex(getIndexInDeviceSet());
|
||||
|
@ -46,19 +46,22 @@ public:
|
||||
|
||||
public:
|
||||
const PERTesterSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigurePERTester* create(const PERTesterSettings& settings, bool force) {
|
||||
return new MsgConfigurePERTester(settings, force);
|
||||
static MsgConfigurePERTester* create(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigurePERTester(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
PERTesterSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigurePERTester(const PERTesterSettings& settings, bool force) :
|
||||
MsgConfigurePERTester(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -173,8 +176,8 @@ private:
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void applySettings(const PERTesterSettings& settings, bool force = false);
|
||||
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const PERTesterSettings& settings, bool force);
|
||||
void applySettings(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void webapiReverseSendSettings(const QList<QString>& featureSettingsKeys, const PERTesterSettings& settings, bool force);
|
||||
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
||||
|
||||
private slots:
|
||||
|
@ -75,7 +75,13 @@ bool PERTesterGUI::handleMessage(const Message& message)
|
||||
{
|
||||
qDebug("PERTesterGUI::handleMessage: PERTester::MsgConfigurePERTester");
|
||||
const PERTester::MsgConfigurePERTester& cfg = (PERTester::MsgConfigurePERTester&) 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);
|
||||
@ -159,6 +165,7 @@ PERTesterGUI::~PERTesterGUI()
|
||||
void PERTesterGUI::setWorkspaceIndex(int index)
|
||||
{
|
||||
m_settings.m_workspaceIndex = index;
|
||||
m_settingsKeys.append("workspaceIndex");
|
||||
m_feature->setWorkspaceIndex(index);
|
||||
}
|
||||
|
||||
@ -217,6 +224,14 @@ void PERTesterGUI::onMenuDialogCalled(const QPoint &p)
|
||||
setTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
m_settingsKeys.append("title");
|
||||
m_settingsKeys.append("rgbColor");
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIFeatureSetIndex");
|
||||
m_settingsKeys.append("reverseAPIFeatureIndex");
|
||||
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -244,6 +259,7 @@ void PERTesterGUI::on_resetStats_clicked()
|
||||
void PERTesterGUI::on_packetCount_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_packetCount = value;
|
||||
m_settingsKeys.append("packetCount");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -252,6 +268,7 @@ void PERTesterGUI::on_start_currentIndexChanged(int index)
|
||||
m_settings.m_start = (PERTesterSettings::Start)index;
|
||||
ui->satellites->setVisible(m_settings.m_start != PERTesterSettings::START_IMMEDIATELY);
|
||||
ui->satellitesLabel->setVisible(m_settings.m_start != PERTesterSettings::START_IMMEDIATELY);
|
||||
m_settingsKeys.append("start");
|
||||
applySettings();
|
||||
getRollupContents()->arrangeRollups();
|
||||
}
|
||||
@ -259,54 +276,63 @@ void PERTesterGUI::on_start_currentIndexChanged(int index)
|
||||
void PERTesterGUI::on_satellites_editingFinished()
|
||||
{
|
||||
m_settings.m_satellites = ui->satellites->text().trimmed().split(" ");
|
||||
m_settingsKeys.append("satellites");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_interval_valueChanged(double value)
|
||||
{
|
||||
m_settings.m_interval = value;
|
||||
m_settingsKeys.append("interval");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_packet_textChanged()
|
||||
{
|
||||
m_settings.m_packet = ui->packet->toPlainText();
|
||||
m_settingsKeys.append("packet");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_leading_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_ignoreLeadingBytes = value;
|
||||
m_settingsKeys.append("ignoreLeadingBytes");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_trailing_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_ignoreTrailingBytes = value;
|
||||
m_settingsKeys.append("ignoreTrailingBytes");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_txUDPAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_txUDPAddress = ui->txUDPAddress->text();
|
||||
m_settingsKeys.append("txUDPAddress");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_txUDPPort_editingFinished()
|
||||
{
|
||||
m_settings.m_txUDPPort = ui->txUDPPort->text().toInt();
|
||||
m_settingsKeys.append("txUDPPort");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_rxUDPAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_rxUDPAddress = ui->rxUDPAddress->text();
|
||||
m_settingsKeys.append("rxUDPAddress");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PERTesterGUI::on_rxUDPPort_editingFinished()
|
||||
{
|
||||
m_settings.m_rxUDPPort = ui->rxUDPPort->text().toInt();
|
||||
m_settingsKeys.append("rxUDPPort");
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -351,9 +377,11 @@ void PERTesterGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
PERTester::MsgConfigurePERTester* message = PERTester::MsgConfigurePERTester::create(m_settings, force);
|
||||
PERTester::MsgConfigurePERTester* message = PERTester::MsgConfigurePERTester::create(m_settings, m_settingsKeys, force);
|
||||
m_perTester->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
m_settingsKeys.clear();
|
||||
}
|
||||
|
||||
void PERTesterGUI::makeUIConnections()
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
PluginAPI* m_pluginAPI;
|
||||
FeatureUISet* m_featureUISet;
|
||||
PERTesterSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
RollupState m_rollupState;
|
||||
bool m_doApplySettings;
|
||||
|
||||
|
@ -177,3 +177,134 @@ void PERTesterSettings::deserializeStringList(const QByteArray& data, QList<QStr
|
||||
(*stream) >> strings;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void PERTesterSettings::applySettings(const QStringList& settingsKeys, const PERTesterSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("packetCount")) {
|
||||
m_packetCount = settings.m_packetCount;
|
||||
}
|
||||
if (settingsKeys.contains("interval")) {
|
||||
m_interval = settings.m_interval;
|
||||
}
|
||||
if (settingsKeys.contains("packet")) {
|
||||
m_packet = settings.m_packet;
|
||||
}
|
||||
if (settingsKeys.contains("txUDPAddress")) {
|
||||
m_txUDPAddress = settings.m_txUDPAddress;
|
||||
}
|
||||
if (settingsKeys.contains("txUDPPort")) {
|
||||
m_txUDPPort = settings.m_txUDPPort;
|
||||
}
|
||||
if (settingsKeys.contains("rxUDPAddress")) {
|
||||
m_rxUDPAddress = settings.m_rxUDPAddress;
|
||||
}
|
||||
if (settingsKeys.contains("rxUDPPort")) {
|
||||
m_rxUDPPort = settings.m_rxUDPPort;
|
||||
}
|
||||
if (settingsKeys.contains("ignoreLeadingBytes")) {
|
||||
m_ignoreLeadingBytes = settings.m_ignoreLeadingBytes;
|
||||
}
|
||||
if (settingsKeys.contains("ignoreTrailingBytes")) {
|
||||
m_ignoreTrailingBytes = settings.m_ignoreTrailingBytes;
|
||||
}
|
||||
if (settingsKeys.contains("start")) {
|
||||
m_start = settings.m_start;
|
||||
}
|
||||
if (settingsKeys.contains("satellites")) {
|
||||
m_satellites = settings.m_satellites;
|
||||
}
|
||||
if (settingsKeys.contains("title")) {
|
||||
m_title = settings.m_title;
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor")) {
|
||||
m_rgbColor = settings.m_rgbColor;
|
||||
}
|
||||
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 PERTesterSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("packetCount") || force) {
|
||||
ostr << " m_packetCount: " << m_packetCount;
|
||||
}
|
||||
if (settingsKeys.contains("interval") || force) {
|
||||
ostr << " m_interval: " << m_interval;
|
||||
}
|
||||
if (settingsKeys.contains("packet") || force) {
|
||||
ostr << " m_packet: " << m_packet.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("txUDPAddress") || force) {
|
||||
ostr << " m_txUDPAddress: " << m_txUDPAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("txUDPPort") || force) {
|
||||
ostr << " m_txUDPPort: " << m_txUDPPort;
|
||||
}
|
||||
if (settingsKeys.contains("rxUDPAddress") || force) {
|
||||
ostr << " m_rxUDPAddress: " << m_rxUDPAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("rxUDPPort") || force) {
|
||||
ostr << " m_rxUDPPort: " << m_rxUDPPort;
|
||||
}
|
||||
if (settingsKeys.contains("ignoreLeadingBytes") || force) {
|
||||
ostr << " m_ignoreLeadingBytes: " << m_ignoreLeadingBytes;
|
||||
}
|
||||
if (settingsKeys.contains("ignoreTrailingBytes") || force) {
|
||||
ostr << " m_ignoreTrailingBytes: " << m_ignoreTrailingBytes;
|
||||
}
|
||||
if (settingsKeys.contains("start") || force) {
|
||||
ostr << " m_start: " << m_start;
|
||||
}
|
||||
if (settingsKeys.contains("satellites") || force)
|
||||
{
|
||||
ostr << " m_satellites:";
|
||||
|
||||
for (auto satellite : m_satellites) {
|
||||
ostr << " " << satellite.toStdString();
|
||||
}
|
||||
}
|
||||
if (settingsKeys.contains("title") || force) {
|
||||
ostr << " m_title: " << m_title.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor") || force) {
|
||||
ostr << " m_rgbColor: " << m_rgbColor;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
@ -59,6 +59,9 @@ struct PERTesterSettings
|
||||
|
||||
QByteArray serializeStringList(const QList<QString>& strings) const;
|
||||
void deserializeStringList(const QByteArray& data, QList<QString>& strings);
|
||||
|
||||
void applySettings(const QStringList& settingsKeys, const PERTesterSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_FEATURE_PERTESTERSETTINGS_H_
|
||||
|
@ -107,7 +107,7 @@ bool PERTesterWorker::handleMessage(const Message& cmd)
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
MsgConfigurePERTesterWorker& cfg = (MsgConfigurePERTesterWorker&) cmd;
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
return true;
|
||||
}
|
||||
else if (PERTester::MsgResetStats::match(cmd))
|
||||
@ -121,22 +121,30 @@ bool PERTesterWorker::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void PERTesterWorker::applySettings(const PERTesterSettings& settings, bool force)
|
||||
void PERTesterWorker::applySettings(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "PERTesterWorker::applySettings:"
|
||||
qDebug() << "PERTesterWorker::applySettings:" << settings.getDebugString(settingsKeys, force)
|
||||
<< " force: " << force;
|
||||
|
||||
if ( (settings.m_rxUDPAddress != m_settings.m_rxUDPAddress)
|
||||
|| (settings.m_rxUDPPort != m_settings.m_rxUDPPort)
|
||||
|| force)
|
||||
// if ( (settings.m_rxUDPAddress != m_settings.m_rxUDPAddress)
|
||||
// || (settings.m_rxUDPPort != m_settings.m_rxUDPPort)
|
||||
// || force)
|
||||
if (settingsKeys.contains("rxUDPAddress")
|
||||
|| settingsKeys.contains("rxUDPPort")
|
||||
|| force)
|
||||
{
|
||||
openUDP(settings);
|
||||
}
|
||||
|
||||
if ((settings.m_interval != m_settings.m_interval) || force)
|
||||
if (settingsKeys.contains("interval") || force) {
|
||||
m_txTimer.setInterval(settings.m_interval * 1000.0);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
void PERTesterWorker::openUDP(const PERTesterSettings& settings)
|
||||
|
@ -37,20 +37,23 @@ public:
|
||||
|
||||
public:
|
||||
const PERTesterSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigurePERTesterWorker* create(const PERTesterSettings& settings, bool force)
|
||||
static MsgConfigurePERTesterWorker* create(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigurePERTesterWorker(settings, force);
|
||||
return new MsgConfigurePERTesterWorker(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
PERTesterSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigurePERTesterWorker(const PERTesterSettings& settings, bool force) :
|
||||
MsgConfigurePERTesterWorker(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -79,7 +82,7 @@ private:
|
||||
QList<QByteArray> m_txPackets; //!< Packets we've transmitted, but not yet received
|
||||
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const PERTesterSettings& settings, bool force = false);
|
||||
void applySettings(const PERTesterSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
MessageQueue *getMessageQueueToGUI() { return m_msgQueueToGUI; }
|
||||
void openUDP(const PERTesterSettings& settings);
|
||||
void closeUDP();
|
||||
|
Loading…
Reference in New Issue
Block a user