correct subscription processing

This commit is contained in:
2024-03-24 00:42:03 +02:00
parent b6ade7310a
commit 115bef3dbe
8 changed files with 57 additions and 46 deletions

View File

@ -67,7 +67,6 @@ void ExtSysMonSensor::update()
continue; // skip properties which are not explicitly subscribed
auto value = m_source->data(source);
qCWarning(LOG_ESS) << source << value;
property->setValue(value);
}
}

View File

@ -52,7 +52,7 @@ NetworkSource::~NetworkSource()
QVariant NetworkSource::data(const QString &_source)
{
qCWarning(LOG_ESS) << "Source" << _source;
qCDebug(LOG_ESS) << "Source" << _source;
if (!m_values.contains(_source))
run();
@ -82,7 +82,9 @@ KSysGuard::SensorInfo *NetworkSource::initialData(const QString &_source) const
void NetworkSource::run()
{
m_values["device"] = NetworkSource::getCurrentDevice();
m_process->start("iwgetid", {"-r"});
if (m_process->state() == QProcess::ProcessState::NotRunning) {
m_process->start("iwgetid", {"-r"});
}
}

View File

@ -49,12 +49,10 @@ QVariant WeatherSource::data(const QString &_source)
int ind = index(_source);
if (!m_values.contains(_source)) {
QVariantHash data = m_extWeather->itemByTagNumber(ind)->run();
for (auto &key : data.keys())
m_values[key] = data[key];
auto data = m_extWeather->itemByTagNumber(ind)->run();
m_values.insert(data);
}
QVariant value = m_values.take(_source);
return value;
return m_values.take(_source);
}
@ -94,7 +92,7 @@ KSysGuard::SensorInfo *WeatherSource::initialData(const QString &_source) const
data->unit = KSysGuard::UnitCelsius;
} else if (_source.startsWith("timestamp")) {
data->name = QString("Timestamp for '%1'").arg(m_extWeather->itemByTagNumber(ind)->uniq());
data->variantType = QVariant::String;
data->variantType = QVariant::DateTime;
data->unit = KSysGuard::UnitNone;
}